Android 12 - Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent
See original GitHub issueThe plugin works perfectly in all devices except for Andorid 12. I get following error
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent
I see the problem is in createPendingIntent
Method
private void createPendingIntent() {
if (pendingIntent == null) {
Activity activity = getActivity();
Intent intent = new Intent(activity, activity.getClass());
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
pendingIntent = PendingIntent.getActivity(activity, 0, intent, 0); // Problem in the last param here
}
}
Would like to know if I am doing something wrong? or is this needs to be fixed
P.S I use this plugin for only reading NFC tags
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:25
Top Results From Across the Web
MediaSessionCompat:Targeting S+ (version 31 and above ...
If your app targets Android 12, you must specify the mutability of each PendingIntent object that your app creates.
Read more >Android 12 run: Fatal Exception Targeting S+ (version 31 and ...
Android 12 run: Fatal Exception Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE.
Read more >Targeting S+ (version 31 and above) requires that one of ...
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Read more >Runtime Error: Targeting S+ (version 31 and above) requires ...
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly ...
Read more >PendingIntent - Android Developers
S , it will be required to explicitly specify the mutability of PendingIntents on creation with either (@link #FLAG_IMMUTABLE} or FLAG_MUTABLE .
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@escully27 > OK thanks. Let me know if helpful I can change mine otherwise probably best to do a PR for yours
ok i created a PR, I don’t know how useful it is, there are another 15 waiting for more than two years …
i fixed this on my fork: https://github.com/dilo99/phonegap-nfc