Important notes for background tracking

for background tracking driver app is now using 2 different plugin as follow

  1. cordova-plugin-background-geolocation - this is the old background plugin
  2. cordova-background-geolocation-lt - new plugin

you might be asking why driver appp is using 2 different plugin,
reason is the current plugin called cordova-plugin-background-geolocation does not work well in iOS specially
when app is backgrounnd
while this new plugin called cordova-background-geolocation-lt works in iOS foreground and background

why not use the latest plugin both for android and ios ?
the new plugin is not free is for commercial use and you need to purchase a license in order to use the plugin in android , for more details click here.
on debug mode you still can use android but for production mode you need the license key, and license key can be set in config.xml

why use the new plugin in iOS?
the plugin is free when using for iOS according to author , no need to purchase license key.

In short the new app will be using old plugin for android and new plugin for iOS to avoid purchasing license key.

What if i want to use new plugin for both android and iOS?
You can do that by just little modification in the code, follow the steps below.

  1. Make sure you use the package-ios.json in your package.json when compiling the app in android and iOS
  2. Edit the file www/js/app.js
    simply change
    if(cordova.platformId === "android"){
        initBackgroundTracking();			 	       
    } else if(cordova.platformId === "ios"){ 
       initBackgroundLT();
    }
    
    to
    
    initBackgroundLT();
    
    this means we will use cordova-background-geolocation-lt both android and iOS

My background tracking still does not work?
there are several issue when app is not working in background, solutions below.

  1. When you first run the app make sure you alway set allow all the time in permission. else background tracking will not work

    Android 10

    Allow access all the time

    iOS

    Allow motion activity

    Allow location even not using

  2. When first install the background tracking is not working do, just close the app and run it again.
  3. When mobile phone screen is off background tracking stops,
    it because all network of your phone will be close as well, so make sure
    in your phone settings keep network alive even screen is off.
  4. There are repeatedly reported issues with some android devices not working in the background.
    Check if your device model is on dontkillmyapp list. For more information check out dontkillmyapp.com.