Our project app crashes at the execution of 'this.backgroundGeolocation.start();'
Plugin version: 2.3.6
Platform: Android
OS version: Android 8.1.0
Device manufacturer and model: Google Pixel 2 & Xiaomi Redmi 5 Pro
The App always crashes on 'this.backgroundGeolocation.start();' with no logs in the console.
I created an empty ionic demo Project just to test the plugin on the 08.08.18 and there the plugin worked fine but at the moment at also crashes the demo app as well.
The Demo app should log the tracked coordinates on the screen.
If the app reaches the line of code where: 'this.backgroundGeolocation.start();' is called it just crashes.
¯_(ツ)_/¯
GPS tracking of the traveled route to display it on a map later on.
11-08 16:05:19.742 18927-18927/com.caranea.fahrtenbuch E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.caranea.fahrtenbuch, PID: 18927
android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 color=0x00000000 vis=PRIVATE)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Not sure, but I think you will not be able to use latest cordova android platform, since they're targeting oreo APIs. Oreo brought new backward incompatible requirements for notifications. Try use older cordova or upgrade to 3.x branch of the plugin.
Here is the current config of the plugin:
const config: BackgroundGeolocationConfig = {
desiredAccuracy: 0,
stationaryRadius: 1,
distanceFilter: 1,
activitiesInterval: 1000,
fastestInterval: 900,
saveBatteryOnBackground: false,
interval: 5000,
debug: true, // enable this hear sounds for background-geolocation life-cycle.
stopOnTerminate: false, // enable this to clear background location settings when the app terminates
};
Sorry. my previous post (now deleted) was posted by mistake (it was targeting different issue). This is not configuration issue.
You can check installed version of "cordova-android" in node_modules/cordova-android/package.json. Should not be the newest, but rather 7.1.0 or something close.
EDIT: edited
Also not sure if it's possible to target pre oreo API level on Pixel2 phone. If not, then you'll have to use 3.x version.
all right, i will try it out and let you know, thanks for now for the quick response :-)
So downgrading "cordova android platform" or "cordova-android" from 7.1.1 to 7.0.0 worked fine for me with "cordova-plugin-mauron85-background-geolocation": "2.3.6",. The App dosen't crash anymore and logs the GPS coordinates.
Thanks a lot!
Most helpful comment
So downgrading "cordova android platform" or "cordova-android" from 7.1.1 to 7.0.0 worked fine for me with "cordova-plugin-mauron85-background-geolocation": "2.3.6",. The App dosen't crash anymore and logs the GPS coordinates.
Thanks a lot!