Status Update
Comments
vi...@google.com <vi...@google.com>
ba...@google.com <ba...@google.com> #2
I notice the same issue and LogCat shows the following message:
Google Play services out of date. Requires 3159100 but found 3136130
Google Play services out of date. Requires 3159100 but found 3136130
se...@gmail.com <se...@gmail.com> #3
Same here.
"Google Play services out of date. Requires 3159100 but found 3136130"
"Google Play services out of date. Requires 3159100 but found 3136130"
Description
When targeting Android 12 this permission is supposed to be required to set exact alarms, see:
**Problem:**
In our testing we have found the following with apps targeting Android 12/API 31:
- an app *without* `SCHEDULE_EXACT_ALARM` AndroidManifest permission can still set exact alarms when it is ignoring battery optimizations as per: `PowerManager.isIgnoringBatteryOptimizations()`
- an app *with* `SCHEDULE_EXACT_ALARM` AndroidManifest permission, but has its permission disabled in the `Alarms & reminders` app info, can still set exact alarms when it is ignoring battery optimizations
**Expected behavior:**
- an app *without* `SCHEDULE_EXACT_ALARM` permission should *not* be able to set exact alarms on Android 12 regardless of whether it ignores battery optimizations or not
- an app *with* `SCHEDULE_EXACT_ALARM` permission, but has the permission disabled by the user in the `Alarms & reminders` section, should *not* be able to set exact alarms on Android 12 regardless of whether it ignores battery optimizations or not
Whether a user has set the app to ignore battery optimizations seems odd to be a substitute for the `SCHEDULE_EXACT_ALARM` permission. As per [Android documentation](
> Apps who hold this permission and target API level 31 or above, always stay in the WORKING_SET or lower standby bucket.
This documentation suggests that holding this exact alarm permission has some sort of affect on avoiding Android's built-in battery optimization. However, how they are so tied together and one can circumvent entirely the new permission is puzzling.
Also, many alarm & reminder apps direct their users to disable Android's built-in battery optimizations as it often is a problem for alarm apps (see: `PowerManager.isIgnoringBatteryOptimizations()`). This is the most common issue in our app's 40k+ reviews and we're constantly emailed about this (despite attempting to get users to disable the optimizer after installation and other reminders).
**We have created a sample project that shows this behavior - the project's main features include:**
- Target API 31
- AndroidManifest permission added: `<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />`
- MainActivity's onResume() method queries the result of `PowerManager.isIgnoringBatteryOptimizations()` and `AlarmManager.canScheduleExactAlarms()`, as well as sets an exact alarm and determines if it was successful and displays the info to the activity's screen
- We have also made 2 videos on our Pixel 6 (running Android 12) that show the behavior when adjusting battery optimization, toggling the `Alarms & reminders` manually in app info, and adding/removing `SCHEDULE_EXACT_ALARM` permission in the AndroidManifest
We have shared the files with android-bugreport@google.com and they are available here:
The above behaviors have been seen on our Pixel 6 running Android 12, and our Samsung S22 running Android 12. One can also see this behavior on several alarm apps targeting Android 12, such as Google Clock, Samsung Clock, and others.
Thanks!