-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Display warning in toast if background location is requested but location is turned off in settings #3427
Comments
Hello @lognaturel ! I'd love to try and work on this issue. |
That would be wonderful, @neilong31! I'd recommend starting by making sure you understand the behavior of |
Thank you for a starting point! I'm looking through and trying to understand the behavior. I'll submit a PR detailing my logic. |
Hello @lognaturel , I'd like to work on this issue, is this already being worked on? I found something strange! This block should only run when user has changed the location settings, right? In my case this runs even if i don't change settings, i checked with a Toast message and it is being displayed every time i open up the form entry. |
Please go ahead and claim it, @chidauri. locationPermissionsPreviouslyGranted is a field on the activity so it is set to false each time the activity is rebuilt. So indeed there will always be a permissions check on activity open. I believe that’s the intended flow but haven’t gone back to look at the details. You can verify that this makes sense and offer an alternative if you think it doesn’t. The field represents something more like “permissions known to have been granted during this form edit session” and perhaps you have an alternate name to suggest. |
@lognaturel Hi, can you please point me to where are start-geopoint location requests handled? |
@opendatakit-bot claim |
Was just looking through #3575. I'm a little confused around the issue description:
Is that referring to the dialog that's shown when we return a if (backgroundLocationMessage == BackgroundLocationManager.BackgroundLocationMessage.PROVIDERS_DISABLED) {
new LocationProvidersDisabledDialog().show(getSupportFragmentManager(), LocationProvidersDisabledDialog.LOCATION_PROVIDERS_DISABLED_DIALOG_TAG);
return;
} If that's right? If so should we be showing a dialog rather than a toast to keep it consistent? I wouldn't be surprised if I've massively misinterpreted all of this... |
@seadowg Thanks for taking a step back to discuss the desired behavior! You're correct that for the audit a similar notification is shown in the dialog. This gives the user an opportunity to jump directly to adjust their settings. My reasoning for using a toast in this case was in the forum thread. When designing the background geopoint feature, we got the feedback that there could be legitimate reasons for users to turn off their location. That made me think that perhaps access to background location should be less strongly encouraged than access to location for audit purposes. In either case, if an organization wants to guarantee that location settings are on and can't trust their enumerators, they should put some Android-level assurances in place. A toast feels like the "poke" that the requesting user was requesting without being as strong as a dialog. However, I don't feel super strongly about this. What do you think, @seadowg, @chidauri? Ultimately it comes down to whether we think that location settings are more likely to be off because of a choice the enumerator made in which case a dialog is annoying or because of a mistake/oversight in which case a dialog is helpful. One approach would be to start with the most annoying (and consistent) option and to walk it back if users complain. |
@lognaturel yep in case it is a mistake/oversight, a dialog is a better choice and if the location is turned off knowingly, it should not hurt enumerator to go through an extra step of denying that dialog(or what organisation wants). |
I think a Banner might be the right middleground here as it would also let us link the enumerator to location settings without blocking them. However, I wouldn't want to look at adding new Material components to the |
Thanks for the feedback, @chidauri and @seadowg. @seadowg I think you're absolutely right that a banner would be ideal. So perhaps after it's been introduced for the scoped storage change we can come back to this. In the mean time, I think @chidauri is right that it's not a huge deal to exit out of the dialog. And looking at the code, it's annoying to have a special case and a separate message string for background geopoint. So @chidauri, could you please simplify it so it just uses the same dialog as in the audit case? Thanks very much! |
Let the enumerator know if no location provider is available for a background location request. Forum user request.
BackgroundLocationManager.locationPermissionGranted
does this for audit location requests but not for background location requests. This was not done for background location requests becauselocationClient.isLocationAvailable
docs sayMust be called <b>after</b> Location updates have been requested.
In the case of background location requests, thesetgeopoint
action manages its own location client soBackgroundLocationManager
doesn't request location updates. However, I don't think that the order is strictly necessary and we could calllocationClient.isLocationAvailable
. I believe the reason that requirement is there is to ensure the priority level is set before. It may not be relevant in this case.The text was updated successfully, but these errors were encountered: