Skip to content Skip to sidebar Skip to footer

Geolocation Reporting In Ionic App Background

I intend to get users geolocation even when the app sits dormant in the background and store the same in the database. I'm using katzer's Cordova Background Plug-in, When I try to

Solution 1:

cordova.plugins.backgroundMode.onfailure = function(errorCode) {
console.log(errorCode)
};`

and check as to why is it failing....then again u need to run the locationService function in a timeout function in the background to get updated about the location and check the location from previously got location. Something like this...

cordova.plugins.backgroundMode.onactivate = function () {
        setTimeout(function () {
           a();

        }, 5000);
    }

Hope this helps.

Post a Comment for "Geolocation Reporting In Ionic App Background"