Background Geolocation not working using Cordova-mauron85-background-geolocation and ionic native

Hi!

My background geolocation is not working when I put application on background.

My project is Ionic 2 - angular 2
I use the plugin cordova-mauron85-background-geolocation
I use ionic-native Background-Geolocation
I use watchPotision function and defined a callback function that is never called

In foreground mode, everything works fine because I also use Geolocation.

Thanks for the help

You can see my example there https://github.com/prolland006/ionic2-geoloc/blob/master/src/services/background-geolocation-service.ts

this.watch = Geolocation.watchPosition(this.foreGroundOptions)
        .subscribe((position: any) => {
                if (position.code === undefined) {
                    this.events.publish('BackgroundGeolocationService:setCurrentForegroundLocation', position);
                } else {
                    this.trace.error('BackgroundGeolocationService','constructor',position.message);
                }
            },
            (error)=>{this.trace.error('BackgroundGeolocationService','foreGroundWatchPosition',error)},
            ()=>this.trace.info('watchPosition success'));

I’ll compare and give it a try tonight. Thank you for the reply.

watchPosition is a instant member of Native Geolocation. Is there way to get location using Native “Background Geolocation” even it is in background

I am facing the same issue,

IONIC INFO

sagarpatel@Sagars-MacBook-Air TripLogs % ionic info

Ionic:

   Ionic CLI                     : 6.4.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.5.3
   @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 : none
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 11 other plugins)

Utility:

   cordova-res (update available: 0.15.3) : 0.15.2
   native-run (update available: 1.3.0)   : 0.3.0

System:

   Android SDK Tools : 26.1.1 (/Users/sagarpanchal/Library/Android/sdk)
   ios-deploy        : 1.10.0
   ios-sim           : 8.0.2
   NodeJS            : v12.16.2 (/usr/local/bin/node)
   npm               : 6.14.4
   OS                : macOS Big Sur

Thanks.