Notification Interactions
A user can interact with a notification by:
Tapping the notification
Clicking one of the buttons on the notification
The result of any of those interactions depends on the action you select on the Notification Message Template. There are three options:
Open App: launches the main activity.
Open Deep Link: launches an activity using an intent with
action
set toIntent.ACTION_VIEW
and thedata
field set to the deep link. If this deep link can be handled by an activity in your application, that activity will be launched with the intent. Otherwise, he launched activity will depend on the installed applications on the device.Open URL: launches an activity using an intent with
action
set toIntent.ACTION_VIEW
and thedata
field set to the url. The actual activity that is launched depends on the url and the installed applications on the device. In most cases, urls with http/https scheme will be opened in the browser.
Handling all notification Interactions
If you need to capture all notification interactions, you can implement a BroadcastReceiver
and register it with an <intent-filter>
to receive all intents with action com.bird.broadcast.NOTIFICATION
.
You can also access the custom payload on all notification interaction captured in BroadcastReceiver
using bird.notifications.getNotificationInteraction(intent)
.
Create BroadcastReceiver
:
Register your BroadcastReceiver
as a <receiver>
inside your AndroidManifest.xml
:
Deep Links
In order to receive deep links into your main activity (or another activity), you need to define an <intent-filter>
on your main activity (or another activity) as follows.
You can specify various filters including scheme
, host
, pathPrefix
, etc. Read more about Creating deep links in Android.
Custom Payload
You can set a custom payload on the Notification Message Template to be delivered to your app. You can capture custom payload in two places:
When a notification interaction is received by a
BroadcastReceiver
. See above.When a deep link launches your activity.
In both cases, you can get the custom payload by using the method bird.notifications.getNotificationInteraction(intent)
. The custom payload exists on notificationInteraction.payload
.
Here is how it looks like when a deep link launches your activity:
Last updated