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

locationAlways does not work on Android 10 #917

Open
1 of 2 tasks
hirameee55 opened this issue Sep 20, 2022 · 3 comments
Open
1 of 2 tasks

locationAlways does not work on Android 10 #917

hirameee55 opened this issue Sep 20, 2022 · 3 comments
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform. type: bug Something isn't working

Comments

@hirameee55
Copy link

🔙 Regression

When requesting locationAlways on Android 10, the Runtime Permission dialog does not appear and the API is returned immediately.

According to the Android specification, the "Allow all the time" option is included even when requesting background location on Android 10.
https://developer.android.com/training/location/permissions#request-background-location

Old (and correct) behavior

Version:8.3.0
When I request locationAlways on Android 10, the Runtime Permission dialog appears and I can select "Allow all the time".

Current behavior

Version: 10.0.0
Runtime Permission does not appear on Android 10.

Reproduction steps

Do the following on Android 10 device.

await Permission.locationAlways.request();

Configuration

Version: 10.0.0

Platform:

  • 📱 iOS
  • 🤖 Android

flutter doctor:
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5.1 21G83 darwin-x64, locale en-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.71.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

@Erhannis
Copy link

MIGHT be relevant: on Android 12, at least, I was asking for multiple permissions and it was failing without explanation, but after half an hour of poking around, I looked at logcat and it said "GrantPermissionsViewModel: For R+ apps, background permissions must be requested after foreground permissions are already granted". Separating out the "locationAlways" into its own subsequent request fixed it. (IMO, the library should do that automatically, please.)

@hirameee55
Copy link
Author

hirameee55 commented Sep 23, 2022

This is true for Android R (11) and above, but Android Q (10) can request background and foreground permissions at the same time. The following modification makes this impossible and requires the addition of "Android R or higher" to the break requirement.

#792
#794

@myselfuser1
Copy link

This might help https://www.youtube.com/watch?v=uMvGpBOT0ZY

@JeroenWeener JeroenWeener added platform: android Issue is related to the Android platform. type: bug Something isn't working P2 Important issues not at the top of the work list. labels Aug 31, 2023
@JeroenWeener
Copy link
Contributor

Related to #781. This issue requires logic specific for Android 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants