Open cristianoccazinsp opened 3 years ago
Hi @cristianoccazinsp
Should be fixed in 8.1.0
.
Thanks for the catch !
Regards
crash the application when get notification sdk is 30.
Do you think the above PR introduced a crash with SDK 30?
Hi @codal-mpawar A full stacktrace and some details about the dependencies might be appreciated. Regards
This fix creates this issue #2152
I think Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
(M = Android 6) should be changed to Build.VERSION.SDK_INT > Build.VERSION_CODES.R
(R = Android 11)
Wouldn't that fix the issue only for Android < 12? Meaning that Android 12 will still have the issue reported in https://github.com/zo0r/react-native-push-notification/issues/2152
The problem is probably related to the actual flags being used, which flag would solve the problem for all android versions?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.
Just wondering, is this issue fixed?
I have the issue mentioned in here and the solution here helped me https://stackoverflow.com/a/74549190/6084814. Hope it will help somebody else too.
This fix creates this issue #2152
I think
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
(M = Android 6) should be changed toBuild.VERSION.SDK_INT > Build.VERSION_CODES.R
(R = Android 11)
Yes I am using android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S
in my patch. This stopped working in sdk 31.
Bug
Environment info
react-native info
output:Library version: 8.0.1
Steps To Reproduce
Running:
PushNotification.localNotification({...})
will crash in Android 12.Due to Android 12 changes, trying to display a local or remote notification will fail with the given error on Android 12 (when compiling with SDK 31):
Reference: https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability
The fix should be as follows: https://github.com/zo0r/react-native-push-notification/blob/master/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java#L453
There are also other parts of the code that may use PendingIntent which I haven't tested as I don't use it, but all of these should be updated (https://github.com/zo0r/react-native-push-notification/blob/master/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java#L531). Also,
PendingIntent.FLAG_IMMUTABLE
was added in SDK 23, so a build check also needs to be performed, something like:Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_UPDATE_CURRENT
@Dallas62
Describe what you expected to happen:
Reproducible sample code
Please review the change and