mauron85/cordova-plugin-background-geolocation

Plugin only works in foreground (Android)

sftayyaba opened this issue · 0 comments

I am trying to fetch location data both in foreground when app is active and in background when minimized. It works fine in foreground mode but when I minimize the app no data is fetched

Environment

  • Plugin version: 3.1
  • Platform: iOS or Android -> So far issue with Android, not tested on iOS
  • OS version: 12
  • Device manufacturer and model: Samsung Galaxy s21
  • Cordova version (cordova -v):
  • Cordova platform version (cordova platform ls):
  • Plugin configuration options:
    const config: BackgroundGeolocationConfig = {
    desiredAccuracy: 0, // For reference: 0 is High Accuracy, 10 Medium and 100 Low
    stationaryRadius: 10, //For reference: distance in meters for stationary radius
    distanceFilter: 0.1, //For reference: distance in meter to call update event
    interval: 500,
    fastestInterval: 500,
    activitiesInterval: 500,
    debug: true, // For reference: enable debug to get background-geolocation life-cycle
    stopOnTerminate: true, //For reference: To clear background location settings on app termination
    };

Context

I am trying to fetch location data both in foreground when app is active and in background when minimized. It works fine in foreground mode but when I minimize the app no data is fetched. It may be just something in configuration but I have tried many options so felt necessary to ask

I tried changing the mode to background when minimized and foreground when active, and saw same behaviour.

Expected Behavior

Work in both foreground and background

Actual Behavior

Only working in foreground

Possible Fix

No fix found

Steps to Reproduce

  1. Configure ionic app
  2. run the location tracking in foreground and its fine
  3. minimize the app and no location fetching on background which is an issue
  4. works fine when app is active again

Context

Trying to do path tracking and its a project blocker