App freezing in ion-input lost focus event - ionic 3 - ionic-framework

I’m facing a problem after to update my MacOS to Mojave version, I don’t know why but now, after to build my project to IOS (It happens only in IOS), I have a problem with a ion-input, that I use to enter a money value, always after to lost the focus my App freezes, Do you Know what can I do to fix it?
I’m using this method to apply a mask in ion-input:
https://marlosirapuan.com/maskmoney-no-ionic-2/
tried to remove this method but I still have the same problem…
When I build the same project in a Android device everything is working fine.
This is my environment
MacBook-Pro-de-Dede:getapp dede$ ionic info
cli packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.19.3
ionic (Ionic CLI) : 3.20.1
global packages:
cordova (Cordova CLI) : 8.1.2 (cordova-lib#8.1.1)
local packages:
#ionic/app-scripts : 1.3.12
Cordova Platforms : android 7.1.1 ios 4.5.5
Ionic Framework : ionic-angular 3.5.0
System:
Android SDK Tools : 26.1.1
ios-deploy : 1.9.4
Node : v8.12.0
npm : 6.4.1
OS : macOS
Xcode : Xcode 10.0 Build version 10A255
Environment Variables:
ANDROID_HOME : /Users/dede/Library/Android/sdk/
Misc:
backend : pro
MY PACKAGE.JSON:
{
“name”: “aplicativo”,
“version”: “0.0.1”,
“author”: “Ionic Framework”,
“homepage”: “http://ionicframework.com/”,
“private”: true,
“scripts”: {
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”,
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
},
“dependencies”: {
“#angular/common”: “4.1.3”,
“#angular/compiler”: “4.1.3”,
“#angular/compiler-cli”: “4.1.3”,
“#angular/core”: “4.1.3”,
“#angular/forms”: “4.1.3”,
“#angular/http”: “4.1.3”,
“#angular/platform-browser”: “4.1.3”,
“#angular/platform-browser-dynamic”: “4.1.3”,
“#ionic-native/barcode-scanner”: “^3.14.0”,
“#ionic-native/camera”: “^3.14.0”,
“#ionic-native/core”: “3.12.1”,
“#ionic-native/device”: “^3.14.0”,
“#ionic-native/diagnostic”: “^3.14.0”,
“#ionic-native/file”: “^3.14.0”,
“#ionic-native/geolocation”: “^3.14.0”,
“#ionic-native/in-app-browser”: “^3.14.0”,
“#ionic-native/native-audio”: “^4.0.1”,
“#ionic-native/native-storage”: “^3.14.0”,
“#ionic-native/push”: “^3.14.0”,
“#ionic-native/splash-screen”: “3.12.1”,
“#ionic-native/status-bar”: “3.12.1”,
“#ionic-native/vibration”: “^3.14.0”,
“#ionic/storage”: “^2.0.0”,
“#types/jquery”: “^3.2.17”,
“build”: “^0.1.4”,
“cordova-android”: “7.1.1”,
“cordova-android-support-gradle-release”: “^1.4.5”,
“cordova-browser”: “^4.1.0”,
“cordova-ios”: “4.5.5”,
“cordova-plugin-add-swift-support”: “^1.7.1”,
“cordova-plugin-camera”: “^4.0.3”,
“cordova-plugin-console”: “^1.1.0”,
“cordova-plugin-device”: “^2.0.2”,
“cordova-plugin-file”: “^6.0.1”,
“cordova-plugin-file-transfer”: “^1.7.1”,
“cordova-plugin-geolocation”: “^4.0.1”,
“cordova-plugin-inappbrowser”: “^3.0.0”,
“cordova-plugin-ionic-webview”: “^1.2.1”,
“cordova-plugin-nativeaudio”: “^3.0.9”,
“cordova-plugin-nativestorage”: “^2.3.2”,
“cordova-plugin-splashscreen”: “^4.1.0”,
“cordova-plugin-statusbar”: “^2.4.2”,
“cordova-plugin-vibration”: “^3.1.0”,
“cordova-plugin-whitelist”: “^1.3.3”,
“cordova-sqlite-storage”: “^2.5.0”,
“cordova-support-google-services”: “^1.1.0”,
“cordova.plugins.diagnostic”: “^4.0.10”,
“device”: “0.3.9”,
“io”: “1.0.0”,
“ionic-angular”: “3.5.0”,
“ionic-audio”: “^3.1.0”,
“ionic-plugin-keyboard”: “^2.2.1”,
“ionicons”: “3.0.0”,
“jquery”: “^3.2.1”,
“phonegap-plugin-barcodescanner”: “^8.0.0”,
“phonegap-plugin-multidex”: “^1.0.0”,
“phonegap-plugin-push”: “^2.2.3”,
“rxjs”: “5.4.0”,
“sw-toolbox”: “3.6.0”,
“tslint-config-airbnb”: “^5.2.1”,
“zone.js”: “0.8.12”
},
“devDependencies”: {
“#ionic/app-scripts”: “1.3.12”,
“#ionic/lab”: “1.0.6”,
“typescript”: “2.3.4”
},
“description”: “An Ionic project”,
“cordova”: {
“plugins”: {
“cordova-plugin-console”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-whitelist”: {},
“ionic-plugin-keyboard”: {},
“cordova-plugin-nativeaudio”: {},
“cordova-plugin-ionic-webview”: {},
“cordova-sqlite-storage”: {},
“cordova-android-support-gradle-release”: {
“ANDROID_SUPPORT_VERSION”: “27.+”
},
“phonegap-plugin-barcodescanner”: {
“ANDROID_SUPPORT_V4_VERSION”: “27.+”
},
“cordova-plugin-nativestorage”: {},
“cordova-plugin-geolocation”: {
“GEOLOCATION_USAGE_DESCRIPTION”: “To locate you”
},
“cordova.plugins.diagnostic”: {},
“cordova-plugin-camera”: {
“CAMERA_USAGE_DESCRIPTION”: " ",
“PHOTOLIBRARY_USAGE_DESCRIPTION”: " "
},
“cordova-plugin-file”: {},
“cordova-plugin-file-transfer”: {},
“cordova-plugin-inappbrowser”: {},
“cordova-plugin-vibration”: {},
“cordova-plugin-device”: {},
“phonegap-plugin-push”: {
“SENDER_ID”: “880917288043”,
“FCM_VERSION”: “11.6.2”,
“ANDROID_SUPPORT_V13_VERSION”: “27.+”
}
},
“platforms”: [
“browser”,
“android”,
“ios”
]
}
}
any suggestion? thanks my dear friends!

Related

admobfree.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property

My project is running.it is code working.I was use admob-free npm plugin then show the error on android build time.i was user firebase notification.I show all list of plugin and ionic info.
Show Error
ERROR in ./src/app/service/admobfree.service.ts Module build failed
(from ./node_modules/#ngtools/webpack/src/index.js): Error: E:\git
Live Project\service
app\Service-User-App-\src\app\service\admobfree.service.ts is missing
from the TypeScript compilation. Please make sure it is in your
tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (E:\git Live Project\service
app\Service-User-App-\node_modules#ngtools\webpack\src\angular_compiler_plugin.js:938:23)
at E:\git Live Project\service app\Service-User-App-\node_modules#ngtools\webpack\src\loader.js:42:31
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5) # ./src/app/app.module.ts
29:0-63 56:12-28 # ./src/main.ts # multi ./src/main.ts [ERROR] An
error occurred while running subprocess ng.
ng.cmd run app:ionic-cordova-build:production --platform=android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
My ionic Info
Ionic:
Ionic CLI : 6.19.0 (C:\Users\abc\AppData\Roaming\npm\node_modules\#ionic\cli)
Ionic Framework : #ionic/angular 5.5.2
#angular-devkit/build-angular : 0.1000.8
#angular-devkit/schematics : 10.0.8
#angular/cli : 10.0.8
#ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res : 0.15.4
native-run : 1.5.0
System:
Android SDK Tools : 26.1.1 (D:\androidsdk\Sdk)
NodeJS : v16.15.0 (C:\Program Files\nodejs\node.exe)
npm : 8.5.5
OS : Windows 10
My plugin Info
cordova-admob-sdk 0.24.1 "AdMob SDK"
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-admob-free 0.27.0 "Cordova AdMob Plugin"
cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter"
cordova-plugin-androidx 3.0.0 "cordova-plugin-androidx"
cordova-plugin-app-version 0.1.12 "AppVersion"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-firebasex 11.0.3 "Google Firebase Plugin"
cordova-plugin-geolocation 4.1.0 "Geolocation"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-nativegeocoder 3.4.1 "NativeGeocoder"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-x-socialsharing 6.0.2 "SocialSharing"
cordova-promise-polyfill 0.0.2 "cordova-promise-polyfill"
es6-promise-plugin 4.2.2 "Promise"
my service pagecode( admobfree.service.ts)
import { Injectable } from '#angular/core';
import {
AdMobFree,
AdMobFreeBannerConfig,
AdMobFreeInterstitialConfig,
} from '#ionic-native/admob-free/ngx';
import { Platform } from '#ionic/angular';
#Injectable({
providedIn: 'root'
})
export class AdmobfreeService {
interstitialConfig: AdMobFreeInterstitialConfig = {
isTesting: true, // Remove in production
autoShow: false,
id: "ca-app-pub-3940256099942544/1033173712"
};
constructor(private admobFree: AdMobFree,public platform: Platform) {
platform.ready().then(() => {
this.admobFree.interstitial.config(this.interstitialConfig);
this.admobFree.interstitial.prepare()
.then(() => { }).catch(e => alert(e));
});
this.admobFree.on('admob.interstitial.events.CLOSE').subscribe(() => {
this.admobFree.interstitial.prepare()
.then(() => {}).catch(e => alert(e));
});
}
showBannerAd() {
let bannerConfig: AdMobFreeBannerConfig = {
isTesting: true, // Remove in production
autoShow: true,
bannerAtTop: false,
id: "ca-app-pub-3940256099942544/6300978111"
};
this.admobFree.banner.config(bannerConfig);
this.admobFree.banner.prepare().then(() => {
// success
}).catch(e => alert(e));
}
showInterstitialAd() {
this.admobFree.interstitial.isReady().then(() => {
this.admobFree.interstitial.show().then(() => {
})
.catch(e =>alert("show "+e));
})
.catch(e =>alert("isReady "+e));
}
}

IONIC 5 hardware back button causes the app close

i'm using this code in my app.component.ts to handle hardware back button :
this.platform.backButton.subscribeWithPriority(10, (processNextHandler) => {
console.log('Back press handler!');
if (this.location.isCurrentPathEqualTo('/home')) {
// Show Exit Alert!
console.log('Show Exit Alert!');
this.showExitConfirm();
processNextHandler();
} else {
// Navigate to back page
console.log('Navigate to back page');
this.router.navigateByUrl['/home'];
this.location.back();
}
});
but it's not working it works only when lunch the app for the first time,later when I press back button the app closes ,I've tried many solutions but none of them works , both on simulator and real device with different versions of android (8,9,10) and same behaviour
my ionic info :
Ionic CLI : 5.4.16
Ionic Framework : #ionic/angular 5.6.13
#angular-devkit/build-angular : 0.803.29
#angular-devkit/schematics : 8.3.29
#angular/cli : 8.3.29
#ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 9.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 14 other plugins)
Utility:
cordova-res : 0.15.1
native-run : 1.4.0
System:
Android SDK Tools : 26.1.1 ()
NodeJS : v12.16.1 ()
npm : 6.13.4
OS : Windows 10
This is my Working Code here
this.plt.backButton.subscribeWithPriority(5, () => {
console.log("Back button Clicked")
var backRoute = this.prevRoute.getPreviousUrl();
if (this.auth.isAuthenticated.value && backRoute == '/login') {
navigator['app'].exitApp();
} else {
this.router.navigateByUrl(backRoute)
}
})
the same code works for me , the issue was in ionViewWillLeave() function , when I remove it , the code works

Ionic backgorund mode crash

I am trying to make run a background mode with Ionic, but when I am playing a song, and I enabled the Backgound Mode, the app crashes.
Actually, is posible make the background mode with Ionic?
This is my code:
import { Component } from '#angular/core';
import {NavController} from '#ionic/angular';
import {NativeAudio} from '#ionic-native/native-audio/ngx';
import {BackgroundMode} from '#ionic-native/background-mode/ngx';
#Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
constructor(public navCtrl: NavController,
public nativeAudio: NativeAudio ,
public backgroundMode: BackgroundMode) {
this.nativeAudio.preloadSimple('audio1', 'assets/audio1.mp3').then((msg) => {
console.log('message: ' + msg);
}, (error) => {
console.log('error: ' + error);
});
}
public playAudio(){
this.backgroundMode.enable();
this.backgroundMode.on('activate').subscribe(() => {
this.nativeAudio.play('audio1');
});
this.nativeAudio.play('audio1', () => console.log('audio1 is done playing'));
}
}
This is my current config.
/bg-mode-example$ ionic info
Ionic:
Ionic CLI : 6.11.11 (/usr/local/lib/node_modules/#ionic/cli)
Ionic Framework : #ionic/angular 5.3.5
#angular-devkit/build-angular : 0.1000.8
#angular-devkit/schematics : 10.0.8
#angular/cli : 10.0.8
#ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 9.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 6 other plugins)
Utility:
cordova-res (update available: 0.15.1) : 0.6.0
native-run (update available: 1.2.1) : 0.2.8
System:
Android SDK Tools : 26.1.1 (/home/gabriel/Android/Sdk)
NodeJS : v10.19.0 (/usr/bin/node)
npm : 6.14.8
OS : Linux 5.4
Addionationally, I have a gitlab repo https://gitlab.com/gabrielrincon/bgmode-testing/
What is wrong?
Thanks very much.
I can make it.
The problem is a permission. The FOREGROUND_SERVICE.
I add to platforms/android/app/src/main/AndroidManifest.xml and work
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
I hope that it help you

Error io.branch.referral.InstallListener Class Not Found Crash Ionic v5

I have an issue with an ionic app and branch SDK, at test ENV everything works as expected but users' in PROD crash continuously.
As stated in the branch docs I have initialized branch on platform ready event at app.component.ts:
app.component.ts
import { Component } from "#angular/core";
import { Platform } from "ionic-angular";
import { StatusBar, Splashscreen } from "ionic-native";
import { TabsPage } from "../pages/tabs/tabs";
#Component({
template: `<ion-nav [root]="rootPage"></ion-nav>`
})
export class MyApp {
rootPage = TabsPage;
constructor(platform: Platform) {
platform.ready().then(() => {
StatusBar.styleDefault();
Splashscreen.hide();
branchInit();
});
platform.resume.subscribe(() => {
branchInit();
});
// Branch initialization
const branchInit = () => {
// only on devices
if (!platform.is("cordova")) {
return;
}
const Branch = window["Branch"];
Branch.initSession().then(data => {
if (data["+clicked_branch_link"]) {
// read deep link data on click
alert("Deep Link Data: " + JSON.stringify(data));
}
});
};
}
}
The error is as follows:
Unable to instantiate receiver io.branch.referral.InstallListener: java.lang.ClassNotFoundException: Didn't find class "io.branch.referral.InstallListener"
Here's my ionic info
Ionic:
Ionic CLI : 5.4.15 (/Users/path/.nvm/versions/node/v9.6.0/lib/node_modules/ionic)
Ionic Framework : #ionic/angular 4.11.5
#angular-devkit/build-angular : 0.12.4
#angular-devkit/schematics : 7.2.4
#angular/cli : 7.2.4
#ionic/angular-toolkit : 1.3.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 30 other plugins)
Utility:
cordova-res : not installed
native-run (update available: 0.3.0) : 0.2.7
System:
Android SDK Tools : 26.1.1 (/Users/path/Library/Android/sdk)
NodeJS : v9.6.0 (/Users/path/.nvm/versions/node/v9.6.0/bin/node)
npm : 2.15.12
OS : macOS High Sierra
Xcode : Xcode 10.1 Build version 10B61
I didn't find good documentation about the issue and I am not sure if removing the library will result in not getting the install referrer, but after some investigation, I decided to remove these lines from AndroidManifest.xml
<receiver android:name="io.branch.referral.InstallListener" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
The following link talks about a communication sent by branch and outdated documentation and makes allusion to the above solution.
https://github.com/BranchMetrics/unity-branch-deep-linking-attribution/issues/171
I think it can be fixed with switching to new Install referrer. Because this crash started from builds that have been released in March, and it tells that from March 1, 2020 it's deprecated: https://android-developers.googleblog.com/2019/11/still-using-installbroadcast-switch-to.html

Ionic 3 : geolocation isn't stable across the different Android versions

I'm working on an Ionic project based on geolocation and after testing my App on four real devices, I distinguished three different behaviors:
1) Android 4.x ( J1 Samsung) => works Correctly
2) Android 5.0.1 => The first time I install the App all works as expected but when I disable GPS and enable it again, the geolocation returns a position which is far about 1Km of my position and it still bugged until I restart the Phone and then it works correctly again until I restart GPS.
3) Android 5.1 => Same scenario of the Android 5.0.1 but after turning GPS OFF and enabling it again, the geolocation still returning an error "timeout" until I restart the Phone.
Please, I have to know if there is no solution or I can continue with this plugin?
Home.ts:
import { Component, ViewChild, ElementRef } from '#angular/core';
import { NavController, Platform } from 'ionic-angular';
import { Geolocation } from '#ionic-native/geolocation';
declare const google;
#Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
#ViewChild('map') mapElement: ElementRef;
map: any;
constructor(public navCtrl: NavController,
private platform:Platform,
private geolocation:Geolocation) {
}
ionViewDidLoad(){
new Promise(resolve => {
setTimeout(() => {
this.initMap();
resolve();
},2000);
})
.then(()=>{
setTimeout(() => {
this.getGeolocation();
},2000);
});
}
initMap() {
// map implementation
}
getGeolocation(){
this.platform.ready().then(() => {
alert('start geolocation');
var options = {
timeout: 20000,
enableHighAccuracy:true,
};
this.geolocation.getCurrentPosition(options).then(resp => {
alert('done');
console.log(resp.coords.latitude);
console.log(resp.coords.longitude);
let origin = new google.maps.LatLng( resp.coords.latitude,resp.coords.longitude);
this.addMarker(origin);
this.map.setCenter(origin);
}).catch((error) => {
this.debugError(error);
alert('error geoloc');
});
});
}
addMarker(location) {
//addMarker implementation
}
debugError(object){
var output = '';
for (var property in object) {
output += property + ': ' + object[property]+'; ';
}
alert(output);
console.log(output);
}
}
ionic info:
cli packages: (/usr/lib/node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
#ionic/app-scripts : 3.1.8
Cordova Platforms : android 6.3.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v8.9.4
npm : 5.7.1
OS : Linux 4.13
Environment Variables:
ANDROID_HOME : xxx
Misc:
backend : pro
cli packages: (/usr/lib/node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
#ionic/app-scripts : 3.1.8
Cordova Platforms : android 6.3.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v8.9.4
npm : 5.7.1
OS : Linux 4.13
Environment Variables:
ANDROID_HOME: xxx/Sdk
Misc:
backend: pro