react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

The background geolocation takes a long time to start when I keep the app in the killed state, and it doesn't start when I am walking. However, when I am riding a bike, then coordinates are received

Open Sarveshwins opened this issue 2 years ago • 6 comments

Your Environment

  • Plugin version: 4.12.1
  • Platform: iOS
  • OS version: 16.7.2
  • Device manufacturer / model: iphone 11
  • React Native version (react-native -v): 0.64.0
  • Plugin config
     const state = await BackgroundGeolocation.ready({
      url: API_URL + API_ENDPOINTS.SAVELOCATION,
      //debug: true,
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter: 10,
      // locationUpdateInterval: interval,
      stopTimeout: 5,
      locationTemplate:
        '{"Latitude":<%= latitude %>,"Longitude":<%= longitude %>,"TimeStamp": "<%= timestamp %>"}',
      locationAuthorizationRequest: 'Always',
      backgroundPermissionRationale: {
        title:
          "Allow {applicationName} to access this device's location even when closed or not in use.",
        message:
          'This app collects location data to enable recording your trips to work and calculate distance-travelled.',
        positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
        negativeAction: 'Cancel',
      },
      headers: {
        authorization: 'Bearer ' + getToken.data.Token,
        source: source,
      },
      params: {
        ClientId: respo_storage.data.ClientId,
      },
      batchSync: true,
      autoSync: true,
      maxDaysToPersist: 14,
      stopOnTerminate: false,
      startOnBoot: true,
      enableHeadless: true,
      // preventSuspend:true
    });

Expected Behavior

it should give us the coordinates that we are posting in api after going to killed state

Actual Behavior

its giving the coordinates after some time dont know why this is happening

Steps to Reproduce

  1. after giving all the permissions like always allow to location go to killed state
  2. now you are unable to see the location icon for some time and after some time it will start showing dont know its based on distance as i am walking but when i go somewhere on bike it starts showing the icon and coordinates being saved

Context

Actually when i go to killed state in android its working fine like we are getting the coordinates but in case of ios in foreground state it works fine but when the app is in killed state it starts giving coordinates after some time i dont know its depend on time or distance

Debug logs

I am unable to reproduce logs as i am checking it in killed state in foreground state its working fine
PASTE_YOUR_LOGS_HERE

Sarveshwins avatar Nov 16 '23 03:11 Sarveshwins

There are some conditions for iOS

  • When an iOS app is terminated you get no data.
  • When the device moves about 200 meters after being terminated, the OS will automatically relaunch your app in the background (just as if launched by the user from the home-screen) and tracking resumes. Your app is no longer terminated, it is now running in the background.
  • OS itself will take care of re-booting the device behind the scene and also user won't be seeing it in the background apps on his/her device. So, for the user app is still terminated and for OS, it's in the background.
  • iOS needs Wifi enabled so it can use the geolocation of detected wifi routers to evaluate geofences. It doesn't mean the device needs to actually be authenticated with a router.

mohitDhami87 avatar Nov 16 '23 08:11 mohitDhami87

This package is not working on some android and ios devices and we are unable to find the devices as they are live users may i know the device names on which this package doesn't support or the minimum api level and os version please?

Sarveshwins avatar Nov 16 '23 11:11 Sarveshwins

This package is not working on some android

See https://dontkillmyapp.com

Performance of iOS is consistent across all device models.

christocracy avatar Nov 16 '23 13:11 christocracy

The plug-in works on a remarkably wide range of OS:

  • Android: 4.4.4+ (including latest 14)
  • iOS: 8.3+

christocracy avatar Nov 16 '23 13:11 christocracy

Will the latest version 4.14.4 will perfectly work with react native version 0.64.0 if i try to update the latest plugin version?

Sarveshwins avatar Nov 17 '23 02:11 Sarveshwins

I have no idea. I use 0.72.4. It probably works.

christocracy avatar Nov 17 '23 02:11 christocracy

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

github-actions[bot] avatar Apr 19 '24 01:04 github-actions[bot]

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

github-actions[bot] avatar May 03 '24 01:05 github-actions[bot]