How to request high accuracy using Google services even when locations services are already on?
Taxi4you opened this issue · 2 comments
If user's GPS is already OFF and I try to request to open it, it pops a Google service message prompt confirmation. That is good, since without this, the position of the users doesn't get track. For example, if the user's GPS are already turned on and I try to request - nothing happens and in this situation the GPS plugin doesn't success to track his position! I have to send him a message like this: "please turn off GPS services, minimize the app and reopen it and try again" only by that happens, the cordova-plugin-request-location-accuracy functions and requests the high accuracy and then the GPS plugin successfully tracks the user's position.
How to request for Google's services high accuracy EVEN if the user's geolocation services are already enabled?
the same thing happens to me
When you request High Accuracy mode on Android using this plugin, the dialog will only be displayed to the user if the Google Play Services location library determines that either location services are off OR high accuracy is not already enabled.
On older versions of Android (8 and below), it is possible to explicitly set the location mode (High Accuracy/Battery Saving/Device Only).
However on Android 9 and above, you can only turn Google Location Accuracy On/Off which (On === High Accuracy, Off === Device Only).
See Manage your Android device’s location settings for more.
On Android 10/11, even if you turn Google Location Accuracy to Off, the reported device location mode is High Accuracy - you can check this using the example project app which uses getLocationAuthorizationStatus()
from cordova-diagnostic-plugin
to determine the current location mode.
TL;DR: if the device reports location mode is currently High Accuracy and you request High Accuracy mode, the dialog will not be shown.
This is not the fault of the plugin, it's the intended behaviour of the Google Play Services location API which this plugin wraps.
See also Change location settings.