Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent
See original GitHub issueDescribe the bug I’m able to obtain the token no problem but when a notification is triggered I get the following error in Android Simulator and no push notification is presented on the device. This is an issue with Android 12.
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent
To Reproduce Steps to reproduce the behavior:
- Open an app running this plugin on an Android 12 device
- Attempt to send a firebase cloud message using the token obtained to the device
Expected behavior To receive the push notification on the device when the app is closed
Smartphone (please complete the following information):
- Pixel 5
- Android
- 12
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
MediaSessionCompat:Targeting S+ (version 31 and above ...
MediaSessionCompat:Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a ...
Read more >Targeting S+ (version 31 and above) requires that ... - GitHub
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.
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 >Xamarin Forms: Targeting S+ (version 31 and above) requires ...
Xamarin Forms: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a ...
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 FreeTop 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
Top GitHub Comments
For those that come across this issue, I fixed this in my Ionic Capacitor app by doing the following:
Open
android > variables.gradle
and changefirebaseMessagingVersion
to 23.0.0Then because I also use @capacitor/push-notifications plugin I had to add
implementation "com.google.firebase:firebase-iid:21.1.0"
to the dependencies innode_modules > @capacitor > push-notifications > android > build.gradle
Yeah I think so. We need to just increment and test the plugin to make sure nothing breaks.