Until now a click on notification is handled in LeanplumPushReceiver which decides what to do next and what activity should be started. With version 12 notifications must start activity directly. This results in a change in the LeanplumPushService.handleNotification to assign the correct activity to the notification intent and bypass the LeanplumPushReceiver.
If we bypass the receiver we can't make the correct tracking of the Push Opened and Open events and also we can't run the Open Action of the message. To solve it the message is attached as an extra in the notification intent and it is processed in the ActivityLifecycleCallbacks object.
Important to note is that if Open Action of the push notification is Open URL which opens another app this will result in not tracking the Push Opened and Open events because we can't get feedback when the user clicks the notification.
Another important note is that when main activity is set as singleTop the client must call setIntent(intent) inside Activity.onNewIntent method to allow the lifecycle callback to work properly.
Check the docs for further details about the implementation.
Background
This change makes the SDK compliant with Android 12 trampoline restrictions.
Until now a click on notification is handled in
LeanplumPushReceiver
which decides what to do next and what activity should be started. With version 12 notifications must start activity directly. This results in a change in theLeanplumPushService.handleNotification
to assign the correct activity to the notification intent and bypass theLeanplumPushReceiver
.If we bypass the receiver we can't make the correct tracking of the
Push Opened
andOpen
events and also we can't run theOpen Action
of the message. To solve it the message is attached as an extra in the notification intent and it is processed in theActivityLifecycleCallbacks
object.Important to note is that if
Open Action
of the push notification isOpen URL
which opens another app this will result in not tracking thePush Opened
andOpen
events because we can't get feedback when the user clicks the notification.Another important note is that when main activity is set as
singleTop
the client must callsetIntent(intent)
insideActivity.onNewIntent
method to allow the lifecycle callback to work properly.Check the docs for further details about the implementation.