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


#1

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


#2

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'));

#3

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


#4

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