As per Google's policy, I updated my targetSdkVersion and compileSdkVersion to 31. But I noticed that the Flutter local notification package now throws error for incoming messages as below:
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.
I went through all the Stack overflow answers related to this error and made following changes:
- Added below Java and Kotlin dependencies in build.gradle file:build.gradle file
- Added this receiver below activity tag: Receiver tag
- Added exported flag under activity tag: Exported flag
- Updated gradle version to latest in gradle-wrapper.properties: Latest gradle version I am not using any PendingIntent in my code, and simulating app on simulator with API 31 level. Could someone please help me in resolving this issue with message notifications?