This repository has been archived by the owner on Aug 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
SETTINGS_CHANGE_UNAVAILABLE when locations are enabled #47
Labels
migrated googlesamples
Migrated from old googlesamples repos
Comments
Yes, I have the same problem! |
+1 |
I'm also struggling with this. |
+1 |
Same problem here. Looks like we won't get a fix anytime soon. Anybody has a good workaround to suggest? |
It seems you can still check for GPS and Network providers via the legacy LocationManager. See below code (a bit specific, and Xamarin, but hey, you get the idea). private IObservable<GoogleApiClient> ManualLocationCheck(GoogleApiClient client)
{
Debug.WriteLine("Google can't tell us how to get location. Checking for ourselves");
/*
It looks like we can get a "Settings change unavailable" when the user
is in airplane mode, but the location is enabled.
So let's check whether location is enabled, because that's all we need.
*/
var locationManager = (LocationManager)activity.GetSystemService(Context.LocationService);
bool gpsEnabled;
bool networkEnabled;
try
{
Debug.WriteLine("Checking for GPS support");
gpsEnabled = locationManager.IsProviderEnabled(LocationManager.GpsProvider);
}
catch (Exception e)
{
Debug.WriteLine(e);
gpsEnabled = false;
}
try
{
Debug.WriteLine("Checking for network support");
networkEnabled = locationManager.IsProviderEnabled(LocationManager.NetworkProvider);
}
catch (Exception e)
{
Debug.WriteLine(e);
networkEnabled = false;
}
if (gpsEnabled || networkEnabled)
{
// Looks like we'll be able to get a location fix after all...
OnUncertainLocationAvailability?.Invoke(new UncertainLocationAvailability
{
GpsEnabled = gpsEnabled,
NetworkEnabled = networkEnabled
});
return Observable.Return(client);
}
else
{
// Nah, nothing we can do except ask the user to fix his settings
throw new LocationNotAvailableException();
}
} |
+1 |
1 similar comment
+1 |
codingjeremy
added
the
migrated googlesamples
Migrated from old googlesamples repos
label
Sep 24, 2019
+1 It is hilarious that we need to use LocationManager as a backup |
+1 |
same happened to me :( |
+1. |
+1 Still having the same issue |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Steps to reproduce:
Expected result:
LocationSettingsStatusCodes.SUCCESS
orLocationSettingsStatusCodes.RESOLUTION_REQUIRED
inonResult
callback, because we're still able to receive updates for the sameLocationRequest
object.Actual result:
LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE
. However, we still can requestLocationUpdates and receive them.The text was updated successfully, but these errors were encountered: