rails-push-notifications icon indicating copy to clipboard operation
rails-push-notifications copied to clipboard

Send additional data using this gem

Open hugoh59 opened this issue 7 years ago • 3 comments
trafficstars

How can you send additonal data like these:

{
  "to": "<token>",
  "time_to_live": 86400,
  "collapse_key": "new_message",
  "delay_while_idle": false,
  "notification": {
    "title": "title",
    "body": "this is a noisy test",
    "tag": "new_message",
    "icon": "new_message",
    "color": "#18d821",
    "sound": "default"
  }
}

using your gem? Thanks

hugoh59 avatar Mar 08 '18 21:03 hugoh59

Hi @hugoh1995 This plugin uses ruby-push-notifications gem to actually push the notifications. You can see an example here of how APNS notifications are created. You can add anything you want to that hash as long as it follows the rules. Hope it helps.

calonso avatar Mar 09 '18 08:03 calonso

@calonso thanks for getting back! I'm looking for an example for Android actually, are there any?

hugoh59 avatar Mar 09 '18 09:03 hugoh59

Sure, you have examples for all supported platforms. Hope it helps!

calonso avatar Mar 09 '18 09:03 calonso