I'm encountering an issue in our Android app where when notification is clicked, the app does not launch. We're using latest Library version 8.1.5 into project.
Some key points from my findings:
- I backtracked and found that on 8.0.9 version, notification seems to be working fine, but from 8.1.0 to 8.1.5, the app would not launch upon notification click.
- This issue is happening on Android 12 and up only.
- Our targetSdkVersion is 34.
- We are following "Full Control Customization" instructions of Salesforce documentation.
When I replace this part in code
builder.setContentIntent( NotificationManager.redirectIntentForAnalytics( context, PendingIntent.getActivity( context, Random().nextInt(), Intent(context, MainActivity::class.java), PendingIntent.FLAG_UPDATE_CURRENT ), notificationMessage, true ) ) with
builder.setContentIntent( PendingIntent.getActivity( context, Random().nextInt(), Intent(context, MainActivity::class.java), PendingIntent.FLAG_UPDATE_CURRENT ) ) the issue is resolved and it works fine.
I found a similar issue was reported on version 8.0.0 also (MarketingCloud AndroidSDK 8.0.0 | Tapping notification does not launch the app on Android 12), and this was fixed in version 8.0.1.
I believe that this issue is back, and needs to be addressed. We cannot remove redirectIntentForAnalytics as we need data about how many users opened the notification.
Could someone please help with this? Thank You
Edit: Pending intent that I am using with this:
PendingIntent.getActivity( context, 0, packageManager.getLaunchIntentForPackage(context.packageName), 0 or PendingIntent.FLAG_IMMUTABLE )
PendingIntenttargeting Android 31+. When I remove theFLAG_IMMUTABLEfrom my test application I receive "Custom notification builder threw an exception. Using default notification builder. - Sdk Version: 8.1.6.0