I have successfully integrated plugin in my app for geolocation services to work in background while showing the icon in the top notification bar.
Step 1: Download the zip folder from the link https://github.com/pmwisdom/cordova-b...
Step 2:Import the Zip folder to Appery Resources - Cordova Plugins
Step 3: Open your App. Make sure the Library version is v3.0 or above in App Settings - External Resources.
Step 4: Click on App Settings- Cordova Plugins - Imported Cordova Plugin and check the required plugin to be added to your project.
Step 5: Go to startScreen and on DeviceReady select the new Javascript function and paste the below code.
//-----------Background Geolocation Mode
// Plugin config settings done by Tooba Atif
navigator.geolocation.getCurrentPosition(function() {
console.log("Successfully retrieved our GPS position, we can now start our background tracker.");
}, function(error) {
console.error(error);
});
//Get plugin
var bgLocationServices = window.plugins.backgroundLocationServices;
//Congfigure Plugin
bgLocationServices.configure({
//Both
desiredAccuracy: 20, // Desired Accuracy of the location updates (lower means more accurate but more battery consumption)
distanceFilter: 5, // (Meters) How far you must move from the last point to trigger a location update
debug: true, // , err);
});
//Start the Background Tracker. When you enter the background tracking will start, and stop when you enter the foreground.
bgLocationServices.start();
///later, to stop
//bgLocationServices.stop();
Step 6: Add your other app functionality respectively and test. Make sure you are moving as the plugin detects activity and then update the location only to save battery. For more information read the plugin home page.
Let me know if someone got any issues with development.