0

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 ) 
5
  • Open a support case. Commented Apr 11, 2024 at 11:53
  • Also, check your logs. You do not have the appropriate FLAGS for a PendingIntent targeting Android 31+. When I remove the FLAG_IMMUTABLE from my test application I receive "Custom notification builder threw an exception. Using default notification builder. - Sdk Version: 8.1.6.0 Commented Apr 11, 2024 at 12:18
  • java.lang.IllegalArgumentException: com.salesforce.marketingcloud.explorer.debug: 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." Commented Apr 11, 2024 at 12:20
  • @BillMote, thanks for the reply. I am using FLAG_IMMUTABLE with pendingIntent. I have updated the question with pendingIntent that I am using. Could you suggest what else might be the case for this issue? Also why does it work without 'redirectIntentForAnalytics' function? Commented Apr 11, 2024 at 12:45
  • Open a support case. Commented Apr 11, 2024 at 13:53

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.