0

Similar question: Android 12 - Notification trampoline restrictions

My question is slightly different from the above question because I am asking for a fundamental proper way to handle the deeplinks.

I am displaying the notification triggered by the Push notification. If the app is Multi-Activity architecture and the app needs to open different Activity depends on the deeplink value, then there are 2 ways to handle:

  1. Interpret the deeplink value first and then register the proper Activity when clicked.
  2. Use a transparent dummy Activity as the destination. Have the TransparentDeeplinkHandleActivity::class.java to handle which Activity to open.

I am an SDK developer which makes it slightly more complicated. I don't know the client's destination Activity class and if they are using Multi-Activity or Single-Activiy-multi-Fragment architecture.

Solution 2 sounds a bit hacky. Should I implement the callback to ask the client-side to return the destination Activity class given the deeplink path?

jclova
  • 5,466
  • 16
  • 52
  • 78

1 Answers1

0

Answering my own question.

I ended up choosing Solution #2, which is the hacky solution:

  1. Use a transparent dummy Activity as the destination. Have the TransparentDeeplinkHandleActivity::class.java to handle which Activity to open.

The reason is that SDK needs to send the analytics before opening the client's "real" Activity.

Pre-Android 12, the SDK is architected to open the BroadCastRecevier and it sends analytics. And then the BroadCastReceiver opens the Activity.

The BroadCastRecevier is now replaced with TransparentDeeplinkHandleActivity for TargetSDK >= 31

jclova
  • 5,466
  • 16
  • 52
  • 78
  • 1
    can you please elaborated more or place sample code to handle notification data payload handling on tap when application is background – vmvyas1989 Jan 27 '23 at 06:13