transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.65k stars 425 forks source link

No GPS callback if there is not internet #1512

Closed techteamPA closed 2 years ago

techteamPA commented 2 years ago

Your Environment

Expected Behavior

The application should receive a GPS callback even if there is no internet connectivity.

Actual Behavior

No logs get logged on the server if there is minimum or no internet connectivity.

Steps to Reproduce

  1. Switch off the internet
  2. Start the application to send logs to the server.

Context

We trying to use the application while traveling on a metro train where there is minimum internet connectivity. The application was tested in released mode.

Debug logs

Logs ``` PASTE_YOUR_LOGS_HERE ```
christocracy commented 2 years ago

Switch off the internet

How exactly are you “switching off the internet”?

You can’t simulate “switching off the internet” by disabling Wifi. Disabling wifi will prevent locations being able to be recorded.

I test 12 Android devices without a SIM card. The plugin tracks fine without a SIM card.

christocracy commented 2 years ago

while traveling on a metro train

Do you know that GPS only works outdoors?

mobile location-services != GPS.

mobile location-services has 3 providers:

  1. GPS (only works outdoors)
  2. Wifi (works wherever wifi signals are detected)
  3. Cellular (last resort. Poor accuracy; ~1000m)
techteamPA commented 2 years ago

Yes we know all these parameters or information about the GPS mechanism However, we just like to know that, no matter if the device is at an outdoor location (or wherever the device can receive the GPS coordinates) the library will provide a callback that can be checked via logs. Right? So that we can rest assured that all these coordinates can be stored in local storage and then an application can try sending the logs to the server if the app is in connectivity

christocracy commented 2 years ago

The plugin doesn’t manufacture locations. It merely turns on a “switch” of the native location api and locations begin to flow.

If the user does something to the device that prevents locations from flowing (turns off wifi) or goes somewhere that receiving a location is impossible (Eg subway tunnel), then there’s no magic that can provide a location.

sometimes, receiving a location is simply impossible.

christocracy commented 2 years ago

So that we can rest assured that all these coordinates can be stored in local storage and then an application can try sending the logs to the server if the app is in connectivity

Read the api docs “HTTP Guide”.

this plugin was originally developed for a disaster response app, tracking emergency workers in earthquakes in an environment where the cellular network is assumed to be destroyed. It is designed to work in “offline” environments, persisting each recorded location to its own SQLite database, uploading those queued locations when a network connection is restored.

techteamPA commented 2 years ago

Read the api docs “HTTP Guide”.

this plugin was originally developed for a disaster response app, tracking emergency workers in earthquakes in an environment where the cellular network is assumed to be destroyed. It is designed to work in “offline” environments, persisting each recorded location to its own SQLite database, and uploading those queued locations when a network connection is restored.

Thank you for sharing the information that was really helpful. Could you please let us know how this offline mechanism works? Can we fetch the offline data from the SQLite table and upload it to our server as soon as the device is back online. Or you would suggest relying on the existing in-built mechanism.

christocracy commented 2 years ago

See api docs .getLocation()

Or you would suggest relying on the existing in-built mechanism.

Why you not provide the plugin a Config.url and let the plugin manage http uploads using its pure native http service? It’s far more reliable than rolling your own in JavaScript.

techteamPA commented 2 years ago

Why do you not provide the plugin a Config.url and let the plugin manage HTTP uploads using its pure native HTTP service? It’s far more reliable than rolling your own in JavaScript.

Thank you for sharing the information that was really helpful. Could you please confirm that the plugin will work in kill state on iOS/Android?

christocracy commented 2 years ago

Could you please confirm that the plugin will work in kill state on iOS/Android?

Yes, that’s why there exists the option Config.stopOnTerminate (and Config.startOnBoot). See the api docs.