Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. {
  2. "data": {
  3. "body": "here is body",
  4. "title": "Title",
  5. "click_action": "YOUR_ACTION"
  6. },
  7. "to": "ffEseX6vwcM:APA91bF8m7wOF MY FCM ID 07j1aPUb"
  8. }
  9.  
  10. <activity
  11. android:name=".NotificationActivity"
  12. android:screenOrientation="portrait"
  13. android:theme="@style/Theme.AppCompat.Dialog"
  14. android:windowSoftInputMode="stateHidden" >
  15.  
  16. <intent-filter>
  17. <action android:name="YOUR_ACTION" />
  18. <category android:name="android.intent.category.DEFAULT" />
  19. </intent-filter>
  20. </activity>
  21.  
  22. Bundle bundle=getIntent().getExtras();
  23. if(bundle!=null) {
  24. for (String key : bundle.keySet()) {
  25. Object value = bundle.get(key);
  26. Log.d("DATA_SENT", String.format("%s %s (%s)", key,
  27. value.toString(), value.getClass().getName()));
  28. }
  29. }
  30.  
  31. {
  32. "data": {
  33. "body": "here is body",
  34. "title": "Title"
  35. },
  36. "notification": {
  37. "body": "here is body",
  38. "title": "Title",
  39. "click_action": "YOUR_ACTION"
  40. },
  41. "to": "ffEseX6vwcM:APA91bF8m7wOF MY FCM ID 07j1aPUb"
  42. }
  43.  
  44. this.notificationListener =
  45. FCMNotification.onNotification((notificationOpen: NotificationOpen) => {
  46. const localNotification = new firebase.notifications.Notification({ sound: 'default', show_in_foreground: true})
  47. .setNotificationId(notificationOpen.notificationId)
  48. .setTitle(notificationOpen.title)
  49. .setSubtitle(notificationOpen.subtitle)
  50. .setBody(notificationOpen.body)
  51. .setData(notificationOpen.data)
  52. .android.setChannelId('cuddlynest')
  53. .android.setColor('#000000')
  54. .android.setAutoCancel(true)
  55. .android.setPriority(firebase.notifications.Android.Priority.High)
  56. .android.setSmallIcon('ic_stat_ic_notification');
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement