pusher / push-notifications-android

Android SDK for Pusher Beams
https://www.pusher.com/beams
MIT License
21 stars 22 forks source link

Set link data on new intent for notification clicks #76

Closed emilkarl closed 5 years ago

emilkarl commented 5 years ago

When specifying the fcm you can now include link and that url will be specified as data on the new intent.

fcm: {
  notification: {
    title: "New friend!",
    body: "Have a look at your new friend"
    click_action: "android.intent.action.VIEW",
  },
  data: {
    link: "myapp://friends"
  }
}`

Add a new intent to your manifest that handles deep linking.

<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:scheme="myapp" />
</intent-filter>

That way it is possible to do deep linking and using intents in Android.

This is a case for the React Native library where we want deep linking and an initial url to be set when opening the app by clicking a notification.

emilkarl commented 5 years ago

@jonathanlloyd any input on this?

daniellevass commented 5 years ago

Thanks @emilkarl for your suggestion!

We have added deep linking to our backlog as we understand this is important! However we'd like to ensure this is consistent across our platforms and this could take some time.

I will close this PR for now, but if you have any other feedback please reach out :-)

mikebridge commented 5 years ago

@daniellevass We are currently investigating the possibility of hacking around this by using the tag field, but it would be great to have an official solution we can add into the react native/pusher beams adapter.

stephenkiers commented 5 years ago

Thanks @emilkarl . We ended up using this suggestion to get it working at Zept. Here is the blog post I wrote about how we implemented this. https://medium.com/@stephenkiers/deep-linking-push-notifications-in-react-native-with-pusher-beams-23525ede30da

Until it is officially supported, this will have to do.