react-native-get-sms-android icon indicating copy to clipboard operation
react-native-get-sms-android copied to clipboard

Error when targeting S+ (version 31 and above)

Open javitolin opened this issue 2 years ago • 7 comments

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!

javitolin avatar Apr 30 '23 19:04 javitolin

any solution to this problem ?

ALIAHSANRST avatar Jun 27 '23 09:06 ALIAHSANRST

I have the same problem, any suggestions?

franzamd avatar Jul 09 '23 18:07 franzamd

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

javitolin avatar Jul 10 '23 14:07 javitolin

Hi ! Same problem for me any solution ?

Ryanx971 avatar Jul 11 '23 19:07 Ryanx971

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.

franzamd avatar Jul 17 '23 00:07 franzamd

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

rammos92 avatar Nov 09 '23 20:11 rammos92

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

Shabdev247 avatar Aug 16 '24 10:08 Shabdev247