Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location: Implement settings request #2216

Merged

Conversation

DaVinci9196
Copy link
Contributor

For some applications that require GPS function, detect and remind the GPS to check in, such as Google Maps

For some applications that require GPS function, detect and remind the GPS to check in, such as Google Maps
@mar-v-in
Copy link
Member

mar-v-in commented Mar 2, 2024

The implemented behavior does not match the documented behavior. According to https://developers.google.com/android/reference/com/google/android/gms/location/SettingsClient, determining the status does never directly result in a dialog to request changes. Instead, when the result does not match the request (the requests field contains a location request that would require a location source currently not active), return a Status with code CommonStatusCodes.RESOLUTION_REQUIRED and a pending intent to the settings dialog as a resolution.

@ale5000-git
Copy link
Member

In my opinion it is better to simply show a dismissable notification that the user can choose to click or to just ignore.
So if the user deliberately don't want to grant it then he/she won't be disturbed too much.

@mar-v-in
Copy link
Member

mar-v-in commented Mar 2, 2024

With the intended flow (using a resolution pending intent) it's up to the calling app if they want to show the dialog to the user or not. I think that's a pretty good solution, as only the calling app knows if it's sensible to disturb the user a lot or not.

@mar-v-in mar-v-in added this to the 0.3.1 milestone Mar 3, 2024
@DaVinci9196
Copy link
Contributor Author

With the intended flow (using a resolution pending intent) it's up to the calling app if they want to show the dialog to the user or not. I think that's a pretty good solution, as only the calling app knows if it's sensible to disturb the user a lot or not.

Google Maps will not pop up a box to request when the GPS is not turned on, so this function was implemented.

@mar-v-in
Copy link
Member

mar-v-in commented Mar 5, 2024

Google Maps will not pop up a box to request when the GPS is not turned on, so this function was implemented.

That's because the current implementation on master does not return a resolution pending intent if the location request is not met yet. Returning a resolution pending intent should result in the desired behavior in Google Maps without breaking other apps as your implementation would.

Check again the documentation on https://developers.google.com/android/reference/com/google/android/gms/location/SettingsClient

@DaVinci9196
Copy link
Contributor Author

Google Maps will not pop up a box to request when the GPS is not turned on, so this function was implemented.

That's because the current implementation on master does not return a resolution pending intent if the location request is not met yet. Returning a resolution pending intent should result in the desired behavior in Google Maps without breaking other apps as your implementation would.

Check again the documentation on https://developers.google.com/android/reference/com/google/android/gms/location/SettingsClient

I re-improved the requestLocationSettingsDialog function

@mar-v-in mar-v-in changed the title request to open device location Location: Implement settings request Mar 19, 2024
@mar-v-in mar-v-in merged commit 2e4d3ae into microg:master Mar 20, 2024
1 check passed
@DaVinci9196 DaVinci9196 deleted the feature_request_to_open_device_location branch May 6, 2024 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants