android_guides icon indicating copy to clipboard operation
android_guides copied to clipboard

settingsClient.checkLocationSettings proper use

Open al-t opened this issue 7 years ago • 0 comments

https://github.com/codepath/android_guides/wiki/Retrieving-Location-with-LocationServices-API

According to the wiki page we check whether the location settings are satisfied with the following lines: SettingsClient settingsClient = LocationServices.getSettingsClient(this); settingsClient.checkLocationSettings(locationSettingsRequest);

But how exactly does it check and what will happen if the setting won't be satisfied. On the settings client page of developers.google.com it says that we should check like that: Task<LocationSettingsResponse> result = LocationServices.getSettingsClient(this).checkLocationSettings(builder.build()); And then we use that Task, add the OnCompleteListener to it and check the result: task.getResult(ApiException.class);

So, my question is - what is point of the line settingsClient.checkLocationSettings(locationSettingsRequest); without anything that related to the Task and checking its result - does it actually check anything and throw any message if the settings are not satisfied?

al-t avatar May 22 '18 07:05 al-t