Ionic 4 on ios: notification on interval, it doesn't track in background app and I can't remove notification after stop (android)
See original GitHub issueYour Environment
`Ionic:
Ionic CLI : 5.0.2 (/usr/local/lib/node_modules/ionic) Ionic Framework : @ionic/angular 4.4.0 @angular-devkit/build-angular : 0.13.9 @angular-devkit/schematics : 7.3.9 @angular/cli : 7.3.9 @ionic/angular-toolkit : 1.5.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : android 8.0.0, ios 5.0.1 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 13 other plugins)
Utility:
cordova-res : not installed native-run : 0.2.2
System:
Android SDK Tools : 26.1.1 (…) ios-deploy : 1.9.4 ios-sim : 8.0.1 NodeJS : v10.15.3 (/usr/local/bin/node) npm : 6.9.0 OS : macOS Mojave Xcode : Xcode 10.2.1 `
- Plugin version: cordova-plugin-mauron85-background-geolocation 3.0.3 “CDVBackgroundGeolocation”
- Platform: iOS or Android
- OS version: MacOS Mojave 10.14.5
- Device manufacturer and model: iPHONE AND SAMSUNG
- Running in Simulator: no
- Cordova version (
cordova -v
): 9.0.0 (cordova-lib@9.0.1) - Cordova platform version (
cordova platform ls
): Installed platforms: android 8.0.0 ios 5.0.1 - Plugin configuration options:
let config :BackgroundGeolocationConfig = {
desiredAccuracy: 10, // precisione in metri
stationaryRadius: 5, // stazionamento
distanceFilter: 1,
interval: 3000,
fastestInterval: 3000,
activitiesInterval: 3000,
debug: true,
locationProvider: 1, //ANDROID_DISTANCE_FILTER_PROVIDER,
notificationTitle: "Registrazione percorso...",
notificationText: "",
stopOnTerminate: false,
activityType: "AutomotiveNavigation", //AutomotiveNavigation - Fitness
pauseLocationUpdates: false,
saveBatteryOnBackground: false,
};
- Link to your project: (local)
Context
On ios, every 3s, a new notification is shown On android can’t close the notification after I stopped the rec. Also both when the app is in background don’t rec.
Expected Behavior
I want just one notification on ios, after finish() to close it, also on android i want to close the notification and also rec in background mode, when maybe I use facebook
Actual Behavior
On ios, every 3s, a new notification is shown On android can’t close the notification after I stopped the rec. Also both when the app is in background don’t rec.
Possible Fix
Steps to Reproduce
Context
Debug logs
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12
Top GitHub Comments
Only adding
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
works for me.Not sure if you guys found a solution for tracking in the background. I had the same issue and think I have resolved by installing background mode plugin https://ionicframework.com/docs/native/background-mode
And then in my code I have added:
I also needed to add the following permission (or the app crashed each time I left the app). I added directly into my AndroidManifest.xml file.
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />