Background geolocation Crash App only android 9

i’m using the plugin Background-Geolocation,,
it worked correctly, but in operating systems android version 9 no, when using the app with android 9 devices the app is closed and indicates the following error “invalid channel for service notification startForeground”
how can I solve that?
I need help urgently please :slight_smile:

I have the same problem, and i solved on this way:

  • Remove @ionic-native/background-geolocation

  • Install this version "cordova-plugin-mauron85-background-geolocation": "^3.0.1".

  • Remove background imports

  • Remove declaration on constructor

  • Add declare var window;

  • Add variable backgroundGeolocation: any;

  • On constructor add this:
    this.platform.ready().then(() => { this.backgroundGeolocation = (<any>window).BackgroundGeolocation; });

  • And to watch coords changes:
    this.backgroundGeolocation.on('location', (location) => {}, (err)=>{})

I hope this solve your problem to.

1 Like

@InsideSistemas i have the same problem, on devices with android above 9 works perfectly.
i tried this solution but when i remove declaration on constructor an imports i’m unable to publish because send the following error message, can you help me? im lost in this plugin with the android 9. sorry for my bad english

This happen becauseyou are using an old version of this “mauron” plugin. you should use
@mauron85/cordova-plugin-background-geolocation”: “^3.1.0”,