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

Error when targeting S+ (version 31 and above) #94

Open
javitolin opened this issue Apr 30, 2023 · 7 comments
Open

Error when targeting S+ (version 31 and above) #94

javitolin opened this issue Apr 30, 2023 · 7 comments

Comments

@javitolin
Copy link

Hi! I'm getting this error when trying to send a SMS:
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.

Any ideas?
Thanks!

@ALIAHSANRST
Copy link

any solution to this problem ?

@franzamd
Copy link

franzamd commented Jul 9, 2023

I have the same problem, any suggestions?

@javitolin
Copy link
Author

Didn't get any answers and didn't get the time to try and fix it myself..

@Ryanx971
Copy link

Hi ! Same problem for me
any solution ?

@franzamd
Copy link

franzamd commented Jul 17, 2023

Hello,

For now update the file in "node_modules/react-native-get-sms-android/android/src/main/java/com/react/SMSModule.java" with these lines of code PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT

The lines of code would look like this:
PendingIntent sentPI = PendingIntent.getBroadcast(context, 0, new Intent(SENT), PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent deliveredPI = PendingIntent.getBroadcast(context, 0, new Intent(DELIVERED), PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);

I found this in some forums for the moment it should work, although I understand that it is not a good practice to modify these node_modules files.

@rammos92
Copy link

rammos92 commented Nov 9, 2023

@franzamd Correct PendingIntent.FLAG_IMMUTABLE
can we add id for autosend and call back?

@Shabdev247
Copy link

Hello,

For now update the file in "node_modules/react-native-get-sms-android/android/src/main/java/com/react/SMSModule.java" with these lines of code PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT

The lines of code would look like this: PendingIntent sentPI = PendingIntent.getBroadcast(context, 0, new Intent(SENT), PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent deliveredPI = PendingIntent.getBroadcast(context, 0, new Intent(DELIVERED), PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);

I found this in some forums for the moment it should work, although I understand that it is not a good practice to modify these node_modules files.

thanks this soluction solved the issues for me

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

No branches or pull requests

6 participants