briankabiro / react-native-get-sms-android

React Native module to get messages on an Android device
MIT License
135 stars 68 forks source link

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

Open javitolin opened 1 year ago

javitolin commented 1 year ago

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 commented 1 year ago

any solution to this problem ?

franzamd commented 1 year ago

I have the same problem, any suggestions?

javitolin commented 1 year ago

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

Ryanx971 commented 1 year ago

Hi ! Same problem for me any solution ?

franzamd commented 1 year ago

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 commented 10 months ago

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

Shabdev247 commented 4 weeks ago

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