question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent

See original GitHub issue

Describe 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:

  1. Open an app running this plugin on an Android 12 device
  2. 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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kyleabenscommented, Feb 27, 2022

For those that come across this issue, I fixed this in my Ionic Capacitor app by doing the following:

Open android > variables.gradle and change firebaseMessagingVersion to 23.0.0

Then because I also use @capacitor/push-notifications plugin I had to add implementation "com.google.firebase:firebase-iid:21.1.0" to the dependencies in node_modules > @capacitor > push-notifications > android > build.gradle

0reactions
stewonescommented, Oct 13, 2022

Is the “upgrade” here as simple as incrementing the version number? Or will there likely be other changes required?

I haven’t delved much into the details of how Capacitor plugins actually work (I’ve only been using them - gratefully)

Yeah I think so. We need to just increment and test the plugin to make sure nothing breaks.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found