Ionic-native: Background geolocation v3 [urgent]

Created on 15 Oct 2018  路  15Comments  路  Source: ionic-team/ionic-native

[ ] bug report
[ X ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/

Current behavior:
v2 version does not work properly on new Android version:
https://github.com/mauron85/cordova-plugin-background-geolocation/issues/493#issuecomment-429156163

Expected behavior:
Implement v3 plugin

Most helpful comment

Sorry, it will not came under window object you can directly access the variable, if typescript shows that an error just declare it globally
declare var BackgroundGeolocation: any;

And use it as normal as specified in the documentation like
BackgroundGeolocation.start();

Also no need to put this in the construtor or ngOnInit

All 15 comments

Since the cordova plugin background geolocation will not work in Oreo when the package point at 2.X branch. Please make changes and point at 3.0 alpha branch

Our app also needs V3 of Cordova plugin of background geolocation

@rodrigoords , Meanwhile did you find any other workaround to use v3 of cordova plugin

No, i tried to use Capacitor to create interface but without success.

Im directly using the BackgroundGeoLocation Plugin with out ionic, it can be accessible via window object.

Can you give some code example plz

I cant seem to find this plugin under window['cordova'].plugins. I can see all my other plugins but not this one. I had installed the latest 3.0.0 alpha 45 version.

Sorry, it will not came under window object you can directly access the variable, if typescript shows that an error just declare it globally
declare var BackgroundGeolocation: any;

And use it as normal as specified in the documentation like
BackgroundGeolocation.start();

Also no need to put this in the construtor or ngOnInit

Work like a charm... thanks

I get error.. it happens in ionic 4.

Uncaught Error: Module cordova-plugin-mauron85-background-geolocation.BackgroundGeolocation does not exist.

Where should I put

declare var BackgroundGeolocation: any;

I am using ionic 4. I get the following error
Uncaught Error: Module cordova-plugin-mauron85-background-geolocation.BackgroundGeolocation does not exist

Uncaught Error: Module cordova-plugin-mauron85-background-geolocation.BackgroundGeolocation does not exist
I am getting same error. If any solution, please provide.

same here with ionic 4 the weird part is that with android live debug works, in production mode not... i have that error, and now the sorce maps are not working on ionic 4

I had this issue when upgrading from version 2 to 3.

My issue was platforms/android/platform_www/plugins/cordova-plugin-mauron85-background-geolocation was not getting removed when I removed the plugin.

I manually removed that folder, and re-installed v3 of the plugin and error went away. Think something went wonky on my Mac, because I still had a the "www/backgroundGeolocation.js" and it should have been uppercase "B" - BackgroundGeolocation.js.

Was this page helpful?
0 / 5 - 0 ratings