Notification Interactions
Last updated
Was this helpful?
Last updated
Was this helpful?
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 . There are three options:
Open App: launches the main activity.
Open Deep Link: launches an activity using an intent with action
set to Intent.ACTION_VIEW
and the data
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 to Intent.ACTION_VIEW
and the data
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.
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
:
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.
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:
You can specify various filters including scheme
, host
, pathPrefix
, etc. Read more about .
You can set a custom payload on the to be delivered to your app. You can capture custom payload in two places:
When a notification interaction is received by a BroadcastReceiver
. See .