Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

PendintIntent problem in Android 12 + #306

Open
Andrea8899 opened this issue May 26, 2023 · 0 comments
Open

PendintIntent problem in Android 12 + #306

Andrea8899 opened this issue May 26, 2023 · 0 comments

Comments

@Andrea8899
Copy link

Good morning,
I set the compileSdkVersion and targetSdkVersion to 31 in my gradle.build file. When I start the app on the emulator with android API 31. I encounter a problem within its Applications class specifically in isAccessibilityServiceActive() when it uses the getActivity() method of the PendingIntent class . In fact the flag within getActivity() is set only to PendingIntent.FLAG_UPDATE_CURRENT while for Android 12 should also be specified one of the two flags PendingIntent.FLAG_UPDATE_MUTABLE or PendingIntent.FLAG_UPDATE_IMMUTABLE.
Below the log of my app:

Caused by: java.lang.IllegalArgumentException: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
at android.app.PendingIntent.getActivity(PendingIntent.java:444)
at android.app.PendingIntent.getActivity(PendingIntent.java:408)
at com.aware.Applications.isAccessibilityServiceActive(Applications.java:664)
at it.uniroma1.di.tappigrafiaandroid.RequestPermission.checkedOrNot(RequestPermission.java:204)
at it.uniroma1.di.tappigrafiaandroid.RequestPermission.onCreate(RequestPermission.java:94)
at android.app.Activity.performCreate(Activity.java:8051)
at android.app.Activity.performCreate(Activity.java:8031)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant