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

Target Android 12 (API Level 31) #1066

Closed
barbeau opened this issue Apr 21, 2021 · 2 comments · Fixed by #1087
Closed

Target Android 12 (API Level 31) #1066

barbeau opened this issue Apr 21, 2021 · 2 comments · Fixed by #1087

Comments

@barbeau
Copy link
Member

barbeau commented Apr 21, 2021

Summary:

By November 2021, all apps being updated on Google Play must target Android 11.

Things I know of that we need to address:

  1. Scoped storage - See https://www.reddit.com/r/androiddev/comments/mwaqn1/scoped_storage_recap/
  2. Location permissions - https://developer.android.com/training/location/permissions says:

Caution: If your app targets Android 11 (API level 30) or higher, the system enforces this best practice. If you request a foreground location permission and the background location permission at the same time, the system ignores the request and doesn't grant your app either permission.

Currently after the user opts-in to travel behavior research I believe we ask for foreground and background location at the same time - we need to update this.

  1. We should add a prompt to the travel behavior research opt-in process that indicates to the user that they will be prompted for background location setting access and activity behavior access.

Steps to reproduce:

Look at build.gradle

Expected behavior:

We currently target Android 10 (API Level 29)

Observed behavior:

App needs to target Android 11 (API level 30)

Device and Android version:

N/A

@barbeau barbeau added this to the v2.6 milestone Apr 21, 2021
@barbeau
Copy link
Member Author

barbeau commented Jul 6, 2021

See also #1076 - I'm not sure if this is a targetSdkVersion issue or behavior on Android 11 - need to investigate further.

@barbeau
Copy link
Member Author

barbeau commented May 10, 2022

Let's go ahead and directly target Android 12. From https://developer.android.com/google/play/requirements/target-sdk, items we need to do to target API level 31 (Android 12):

  • Location: Users can request apps to retrieve only approximate location information. You must request the ACCESS_COARSE_LOCATION permission any time you request ACCESS_FINE_LOCATION.
  • Intent filters: If your app contains activities, services, or broadcast receivers that use intent filters, you must explicitly declare the android:exported attribute for these components.
  • Pending intent mutability: You must specify the mutability of each PendingIntent object that your app creates.
  • Related to reminders - Foreground service launch restrictions: To target Android 12 or higher, your app can't start foreground services while it runs in the background, except for a few special cases. If an app attempts to start a foreground service while running in the background, an exception occurs (except for the few special cases). Consider using WorkManager to schedule and start expedited work while your app runs in the background. To complete time-sensitive actions that the user requests, start foreground services within an exact alarm.

And the Android 11 ones:

@barbeau barbeau changed the title Target Android 11 (API Level 30) Target Android 12 (API Level 31) May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant