Repository navigation
Fix locationAlways does not work on Android 10 - #921
hirameee55 wants to merge 1 commit into
Conversation
|
@mvanbeusekom |
|
|
||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) | ||
| break; |
There was a problem hiding this comment.
Reading through the documentation, I think we should always fall through to the location case and add the ACCESS_COARSE_LOCATION and/ or ACCESS_FINE_LOCATION as well. Meaning we need to remove the break; statement al together.
We should also improve the comment above to reflect this change.
There was a problem hiding this comment.
Hi @mvanbeusekom
Thank you for your review.
If remove the break;, #794 doesn't work.
Android R (11) and above cannot request background and foreground permissions at the same time.
Therefore, for Android R (11) and above, it is ideal to break if Manifest.permission.ACCESS_BACKGROUND_LOCATION is included and acquire permissions only in the background.
There was a problem hiding this comment.
Hi @mvanbeusekom
Could you confirm my comments?
Please feel free to contact us if you have any questions.
✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)
This change fixes the regression described in Issue #917.
The current behavior is that Runtime Permission is not shown when requesting locationAlways on Android 10 (Q).
🆕 What is the new behavior (if this is a feature change)?
In Android Q (10), it is possible to request background and foreground permissions at the same time. LocationAlways satisfies this.
Android 11 (R) or higher cannot request background and foreground permissions at the same time, so v10.0.1 behavior is not affected.
These are Android specifications.
https://developer.android.com/training/location/permissions#request-background-location
💥 Does this PR introduce a breaking change?
No.
🐛 Recommendations for testing
When I request locationAlways on Android 10 (Q), the Runtime Permission appears and I can select "Allow all the time".
📝 Links to relevant issues/docs
🤔 Checklist before submitting
master.