transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
655 stars 277 forks source link

Unable to obtain Background Geolocation in Android 12 when offline #1387

Closed utk4rsh92 closed 2 weeks ago

utk4rsh92 commented 1 year ago

    {
      backgroundPermissionRationale: {
        title: "Allow {applicationName} to access to this device's location in the background?",
        message: "In order to track your activity in the background, please enable {backgroundPermissionOptionLabel} location permission",
        positiveAction: "Change to {backgroundPermissionOptionLabel}",
        negativeAction: "Cancel"
      }, 
      // Geolocation config
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter:10, 
      disableElasticity: true,
      allowIdenticalLocations: true,
      desiredOdometerAccuracy: 100,
      //distanceFilter: 10,
      fastestLocationUpdateInterval: 3000,
      activityRecognitionInterval: 200,
      locationUpdateInterval: 3500,
      foregroundService: true,
      stopOnTerminate:false,
      //forceReloadOnHeartbeat:true,
      //  heartbeatInterval:30,
      geofenceInitialTriggerEntry: true,
      geofenceModeHighAccuracy: true,
      stopTimeout: 300,
      disableStopDetection: true,
      // Application config
      debug: false, // <-- Debug sounds & notifications.
      stopOnTerminate: false,
      startOnBoot: true,
      forceReloadOnBoot: true,
      // HTTP / SQLite config
      url: appcontrol_url,
      //url: s3_url,
      method: 'POST',
      httpRootProperty: '.',
      locationTemplate:
        '{ lat:"<%= latitude %>", lng:"<%= longitude %>" , time:"<%= timestamp %>", speed:"<%= speed %>", bearing:"<%= heading %>", altitude:"<%= altitude %>", debug:"<%= odometer %>",accuracy:"<%= accuracy %>",serviceProvider:"<%= event %>" }',
      geofenceTemplate:
        '{ lat:"<%= latitude %>", lng:"<%= longitude %>" , time:"<%= timestamp %>", speed:"<%= speed %>", bearing:"<%= heading %>", altitude:"<%= altitude %>", debug:"<%= odometer %>",accuracy:"<%= accuracy %>",serviceProvider:"<%= event %>" }',
      extras: {
        locationString: 'TBL_' + client_id + '_' + localStorage.getItem('tablename'),
        empid: '0',
        clientid: client_id,
        deviceId: routeid,
        trackingStatus: 'waypoint'
      },
      autoSync: true,
      maxDaysToPersist: 3
    },

## Expected Behavior
Data must be stored in sqlite database  in the event that the internet is unavailable or disconnected, and whenever it is up, background geolocation must be sent to a url.

## Actual Behavior
In the case of Android 12, the server is not receiving any background geolocation data when the mobile data is turned off and then switched on again, while it operates without issue on Android 9, 10, and 11."
christocracy commented 1 year ago

I develop on a Pixel 6 Android 13. I have no issues. I have a number of other Android 12 devices I regularly field test on.

device specific issues always come down to https://dontkillmyapp.com

utk4rsh92 commented 1 year ago

Could you kindly suggest a solution for the problem of not being able to access background location in offline mode on Android 12?

christocracy commented 1 year ago

solution for the problem

I don’t believe this is an issue of the plugin. I believe it’s an issue with your specific device.

see https://dontkillmyapp.com

utk4rsh92 commented 1 year ago

If we set 'batchsync: true' for background geolocation, do you think it will provide all location data once the device comes back online?

christocracy commented 1 year ago

batchSync does nothing more than control whether http requests are executed one-per-record or all records packed into one http request.

utk4rsh92 commented 1 year ago

could you please guide me on how to check if there are any records in the SQLite plugin when I am offline?

christocracy commented 1 year ago

Are you reading the api docs? You should familiarize yourself with all the available methods.

The method .getCount() might sound particularly interesting.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been inactive for 14 days since being marked as stale.