Open gsk143 opened 1 year ago
Requesting permissions for using GPS should be handled by the developer prior to calling any request for GPS position updated.
If you are requesting continuous GPS updates, then the return value for StartListeningAsync() is Boolean, which will allow you to keep track in your own code of whether or not GPS is being consumed.
@gktval thanks for the response but when I say GPS I am not referring to the permissions but to check whether the GPS location is enabled or not. See the screenshot for more clarity.
So something like this in code
`PermissionStatus status = await Permissions.CheckStatusAsync
if (status == PermissionStatus.Granted)
{
var isGPSEnabled = CrossGeolocator.Current.IsGeolocationEnabled();
if(isGPSEnabled)
{
//Go ahead and get the user location using Gelocatorplugin
}
else
{
//This method will show GPS request just like in maps (see 2nd screenshot)
isGPSEnabled = CrossGeolocator.Current.EnableGPS();
}
}
else
{
//user denied the location request so do something else
//Re request the permission or show alert as to why you need it etc
}
`
As the title suggests is there a way to detect GPS and open the popup for enabling gps on Android? I am looking at this problem for a while but all solutions are either deprecated or don't work properly. It would be nice to have this feature.