codepath / codepath/android_guides

settingsClient.checkLocationSettings proper use

Open
#328 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
28.3k
Forks
6.2k
PR merge metrics
No merged PRs in 30d

Description

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](https://developers.google.com/android/reference/com/google/android/gms/location/SettingsClient) page of developers.google.com it says that we should check like that:
`Task 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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.