-
Notifications
You must be signed in to change notification settings - Fork 299
Description
Problem statement
Deep linking on Android requires the data
field in the Intent
to be set. As described in this SO post or firebase/firebase-android-sdk#6703, the only way to populate the the field in notifications created automatically by the Firebase Android SDK (when the app is in the background) is by setting the gcm.n.link
or gcm.n.link_android
keys in data
, which have reserved prefixes and are therefore not supposed to be used (although setting them works, at least today).
Originally posted by @lehcar09 in #6703:
Alternatively, we can file a feature request to support the
link
orlink_android
field. I’ll get back to you once I hear back from them.
So, this is the FR to officially support these :)
Strawman
A strawman proposal would be to add link
properties to the Notification
/ AndroidNotification
classes, which would then be mapped to gcm.n.link
/ gcm.n.link_android
in the JSON payload. Equivalently, in the HTTP API instead of this:
{
"message": {
"notification": {
"title": "Lorem",
"body": "Ipsum"
},
"data": {
"gcm.n.link": "app://deep/link"
},
}
}
It would be this:
{
"message": {
"notification": {
"title": "Lorem",
"body": "Ipsum",
"link": "app://deep/link"
}
}
}
or this:
{
"message": {
"android": {
"notification": {
"title": "Lorem",
"body": "Ipsum",
"link": "app://deep/link"
}
}
}
}
Alternatives
The workaround suggested here of using setAction
doesn't work, because actions needs to be declared in the Android manifest in order to match the intent, which conflicts with dynamically registering deep link targets.
Thanks!