Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace 0 by PendingIntent.FLAG_IMMUTABLE for Android>12 comptatibility #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

julien-ctx
Copy link

This pull request addresses the requirement of specifying either FLAG_IMMUTABLE or FLAG_MUTABLE when creating PendingIntent instances on Android 12 (API level 31) and higher, as per Android 12 behavior changes.

I edited the source code to replace 0 by FLAG_IMMUTABLE when creating new instances of PendingIntent. In our case, we don't need the PendingIntent to be mutable. That's why I used FLAG_IMMUTABLE.

Thanks to those changes, the library can be used again on latest versions of Android and we avoid having the following error when using the library's methods :

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE

For more information: check the StackOverflow post explaining the issue and its fix.

@rammos92
Copy link

rammos92 commented Nov 9, 2023

can we add an id for autosend and callback?

thaikhuong62000 pushed a commit to thaikhuong62000/react-native-get-sms-android that referenced this pull request Jan 27, 2024
@navdeeshahuja
Copy link

This should be merged.
Facing same problem

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

Successfully merging this pull request may close these issues.

3 participants