Closed imkrishh closed 1 year ago
Hi @imkrishh, could you please describe which notification are you tapping while receiving this crash? Does it contain browserUrl, webViewUrl or Deeplink? It sounds weird because PendingIntent always contains flag "FLAG_MUTABLE"
@riskpp this issue is fatal because i am also facing this issue
Exception java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done (AsyncTask.java:415) at java.util.concurrent.FutureTask.finishCompletion (FutureTask.java:383) at java.util.concurrent.FutureTask.setException (FutureTask.java:252) at java.util.concurrent.FutureTask.run (FutureTask.java:271) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641) at java.lang.Thread.run (Thread.java:920) Caused by java.lang.IllegalArgumentException: at android.app.PendingIntent.checkFlags (PendingIntent.java:377) org.infobip.mobile.messaging.notification.BaseNotificationHandler.createTapPendingIntent
I have one application which is live and we are getting 95% of customer unable to start the application please help here @riskpp
@rohitsurawat and @imkrishh, please describe your exact use cases which are producing this behaviour. Which payload does notification contain? Do you use any of: browserUrl, webViewUrl or deeplink?
@tjuric @riskpp 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.
If you read the stack trace it is clearly stating that while passing the flag Strongly Consider FLAG_IMMUTABLE , only use FLAG_MUTABLE in case if your notification have reply or bubble functionality associated to it.
@tjuric if you see @riskpp last reply according to her it will always be "FLAG_MUTABLE" which is wrong in case of simple notifications.
Also in infobip android sdk Class : MobileMessagingProperty have no decleared enum for FLAG_IMMUTABLE .
Check Line no 59 for android sdk
PENDING_INTENT_FLAGS("org.infobip.mobile.messaging.notification.PENDING_INTENT_FLAGS", (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) ? PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE : PendingIntent.FLAG_CANCEL_CURRENT),
Please help us try to resolve this asap we are getting impacted. Also will share the payload that we are sending asap
@riskpp @tjuric any solution here We are waiting for your response We are sending Simple Plain Text payload in notification which doesn't include any browser url or web url or deep link we don't have such case.
@tjuric @riskpp any update
So I've tested it with "WEB_VIEW_URL" (on the tap webView is opening) on Android 12 emulator (31 API) and I can't reproduce any crashes. If talking about newer Android versions, we don't support them for now, but have tasks for that in our backlog and will work on it soon. We will include the possible update for the flag FLAG_MUTABLE to the FLAG_IMMUTABLE, for the cases when push notification doesn't have possibility to be replied to one of the tasks.
Actually you may try to update react native at least to the 0.68 (I was testing on this) as far as I can see on the documentation, RN started to support 31st Android API from 0.68 version.
@riskpp We were facing huge volume of crashes due to notifications generated from Infobip Portal so 4 days ago we decide to stop delivery of notification, Since than we have faced 111 crashes in production. And from our testing we came to conclusion that code crash at the time notification is created in Android 12 or Higher mobile. So user will no experience any thing. But our business is impacted due to this.
As i can read your older comment you were saying something about change to FLAG_IMMUTABLE , Can you give us an estimated time when we can expect an infobip library update so that we can update test and release a new version for our customers.
Hi @rohitsurawat, the crash is connected with the fact that, starting from android 12, mutability flag should be set (and for 6.3.3 plugin version android sdk, which is inside, contains this flag), I didn't notice for all android versions I've tried that mutable flag instead of immutable can lead to the crash (I already tried 0.65 react native version and Android 13 emulator).
Could you please share with us message or campaign id which you've sent and which caused the crashes, you can do it via e-mail if it's preferable. It'll help us to reproduce the issue and resolve it faster.
Thank you!
@riskpp We have sent email regarding payload and campaign id please check with infobip support team. However we were not able to extract payload or campaign id from portal please provide us clear guide how to extract this info if possible then please respond via email only
Hi @riskpp @tjuric @mstipanov
As suggested by @riskpp we upgraded the versions.
react native : 0.68.3
Infobip version right now is : infobip-mobile-messaging-react-native-plugin: ^6.3.4
But still same crash we shared earlier is coming. Please help us otherwise we are afraid don't have any other option than dropping your service and choose some other service.
@riskpp @mstipanov We need assistance in resolving this as we are facing huge issue from past 1 month. We performed all the changes as said by the Infobip Team but still after releasing the App, we are still facing the issue.
The Crash is only captured in Firebase, Customer doesn't get the Notification on the Device. Notification are not getting delivered, probably failing somewhere in the App during delivery or creating the Notification instance
Caused by java.lang.IllegalArgumentException: 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. keyboard_arrow_up
android.app.PendingIntent.checkFlags (PendingIntent.java:382)
arrow_drop_down
android.app.PendingIntent.getActivities (PendingIntent.java:545)
arrow_right
org.infobip.mobile.messaging.notification.BaseNotificationHandler.createTapPendingIntent (BaseNotificationHandler.java:230)
org.infobip.mobile.messaging.notification.BaseNotificationHandler.createNotificationCompatBuilder (BaseNotificationHandler.java:117)
org.infobip.mobile.messaging.interactive.notification.InteractiveNotificationHandler.getNotificationBuilder (InteractiveNotificationHandler.java:57)
org.infobip.mobile.messaging.interactive.notification.InteractiveNotificationHandler.displayNotification (InteractiveNotificationHandler.java:44)
org.infobip.mobile.messaging.cloud.MobileMessageHandler.handleMessage (MobileMessageHandler.java:72)
org.infobip.mobile.messaging.cloud.MobileMessagingCloudHandler.handleMessage (MobileMessagingCloudHandler.java:92)
org.infobip.mobile.messaging.cloud.MobileMessagingCloudHandler.handleWork (MobileMessagingCloudHandler.java:44)
org.infobip.mobile.messaging.cloud.MobileMessagingCloudService.onHandleWork (MobileMessagingCloudService.java:98)
org.infobip.mobile.messaging.platform.JobIntentService$CommandProcessor.doInBackground (JobIntentService.java:415)
org.infobip.mobile.messaging.platform.JobIntentService$CommandProcessor.doInBackground (JobIntentService.java:405)
android.os.AsyncTask$3.call (AsyncTask.java:394)
arrow_drop_down
java.lang.Thread.run (Thread.java:920)
Hi @quantumarun, @rohitsurawat, Sorry for the delay, we've sent an answer by the e-mail, just to have a followup here:
We’ve check the setup with test application similar to yours and can’t reproduce the issue anyhow. Also we’ve checked your campaign by the provided id and found that you probably have installation of the apps, to which you’ve send the push notifications with version of the react-native plugin, which do not support Android 12 and don’t have the mutability flag set, that could lead to the crash.
BR, Olga
Hello, just to have a followup here, I'm duplicating my answer from the e-mail
I found one issue on the google issues tracker - https://issuetracker.google.com/issues/194108978?pli=1 When targeting Android S+, some internal androidx libraries still could use an older version of WorkManager which do not use FLAG_IMMUTABLE or FLAG_MUTABLE flag. As a workaround you could try to add the latest version of the WorkManager dependency in your app's build.gradle (android/app/build.gradle) & sync the project.
def work_version = "2.7.0"
// (Java only) implementation "androidx.work:work-runtime:$work_version"
// Kotlin + coroutines implementation "androidx.work:work-runtime-ktx:$work_version"
@quantumarun , @rohitsurawat , Could you please clarify, have you managed to resolve the issue by that advice or it still persists?
@quantumarun , @rohitsurawat , Could you please clarify, have you managed to resolve the issue by that advice or it still persists?
We've released actually the change to the FLAG_IMMUTABLE where mutability not required, but still It might be not the reason of why this appears https://github.com/infobip/mobile-messaging-react-native-plugin/releases/tag/6.3.6
Hi @riskpp,
I am also facing the same issue and have tried the fix suggested in #issuecomment-1269770779 but it's not working. I am getting this crash in Google Crashlytics so not able to capture the notification payload.
infobip-mobile-messaging-react-native-plugin -> v6.3.5 react-native -> v0.66.5 compileSdkVersion -> 31 targetSdkVersion -> 31
Hi @imsugat are you sure that the user which got the crash updated the version? I can reproduce this crash only if user has Android 12 and version of the plugin, which doesn't support Android 12 ( < 6.0.0).
I've just found one possible edge case when it could happen:
mobilemesaging.init
wasn't called).mobilemesaging.init
wasn't called on the background when notification arrivedIn this case might happen that property for PendingIntent flags, saved in the Preferences wasn't updated to the new one (which contains FLAG_IMMUTABLE).
We'll try to fix that, but before you from your side could try to be sure that you calling mobilemessaging.init
if application is started by receiving the push notification.
Version with possible fix is released https://github.com/infobip/mobile-messaging-react-native-plugin/releases/tag/7.0.3
Check the Migration guide if you updating from 6.x to 7.x
Hi @riskpp I have tried updating the version of the Infobip plugin in app to 7.0.3 as suggested. While updating I am getting cli error
npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: npm ERR! Found: react-native@0.66.5 npm ERR! node_modules/react-native npm ERR! react-native@"0.66.5" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react-native@">=0.68.0 <1.0.x" from infobip-mobile-messaging-react-native-plugin@7.0.3 npm ERR! node_modules/infobip-mobile-messaging-react-native-plugin npm ERR! infobip-mobile-messaging-react-native-plugin@"7.0.3" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Same issue I have shared via mail.
Hello, The version with the fix requires React Native version 0.68. Please update your application's dependencies to it.
Version with fix was released, can be reopened in case of any other issues
neact native infobip runtime crash on Android
infobip-mobile-messaging-react-native-plugin
-> v6.3.3react-native
-> v0.65.1compileSdkVersion
-> 31targetSdkVersion
-> 31