React-native-background-geolocation: [Question] Is it possible to set GPS only location provider in desiredAccuracy

Created on 30 Nov 2018  路  10Comments  路  Source: transistorsoft/react-native-background-geolocation

Your Environment

  • Plugin version: 2.14.2
  • Platform: Android
  • OS version: NA
  • Device manufacturer / model: NA
  • React Native version (react-native -v): 0.57.5
  • Plugin config

Expected Behavior

NA

Actual Behavior

NA

Steps to Reproduce


NA

Context


According to your docs (https://transistorsoft.github.io/react-native-background-geolocation/interfaces/_react_native_background_geolocation_.config.html#desiredaccuracy) there are several possible values of desiredAccuracy,but I can't see GPS only option

Is it possible to set desiredAccuracy as GPS only ?

I want location from GPS only, not from Wi-Fi or Cellular, because perhaps there is certain amount of inaccuracy (bounce rate) when location is fetched from Cellular/Wi-Fi

Debug logs

NA

NO question

All 10 comments

No, it's not possible. This is handled purely by the operating system. The only way to use GPS is DESIRED_ACCURACY_HIGH / DESIRED_ACCURACY_NAVIGATION.

If you're outdoors, generally GPS will be used.
If you're indoors, GPS is impossible. Wifi will likely be used.
Otherwise, cell tower.

Btw, customers should post issues to the private repo. There's no guarantee of priority support in the public repo.

The reason I post issues in public repo is that I have installed react-native-background-geolocation as npm dependency, not react-native-background-geolocation-android

Secondly there is a setting in Android Devices,where we can set Locating Method to GPS only. Will setting it solve my purpose ?

The reason I post issues in public repo is that I have installed

The public npm version is only updated about every 3 months. Nevertheless, if you want prompt attention to your issues, post to the private repo. It doesn't matter if you install the plugin from private repo or not.

Secondly there is a setting in Android Devices,where we can set Locating Method to GPS only. Will setting it solve my purpose ?

Don't do that. You won't get locations when you're indoors. The native location API will use the best possible source of location. When you're outdoors, that will be GPS.

Also, if you're using geofences, they won't work with GPS only.

I know that GPS doesn't work indoors but it's fine with my use case,As getting no location at all is better than getting even slightly inaccurate location per my use case. My app won't be used indoors

Secondly there is a parameter speed which is returned -1 when location isn't returned from GPS,
Refer https://transistorsoft.github.io/react-native-background-geolocation/interfaces/_react_native_background_geolocation_.coords.html#speed

Is that a reliable check to see whether the location was returned from GPS or not ? If speed is -1, I will not enter that location coordinates in my database

  • speed is available only from GPS.
  • GPS accuracy is typically <= 10 meters.
  • Wifi accuracy is typically 40-60 meters.

And what about cellular accuracy ?

  • Cellular: >= 1000 meters

So that means GPS is the most reliable Location Provider among all three,That is why I want location from GPS only, not from other providers. Anyhow Thanks !

When the device connected to those gps satellites in space, those locations will be used. Otherwise, the next most accurate location will be provided. This all happens deep inside the Android location api.

Was this page helpful?
0 / 5 - 0 ratings