calonso / rails-push-notifications

Rails iOS, Android and Windows Phone Push Notifications made easy!!
https://rubygems.org/gems/rails-push-notifications
MIT License
139 stars 42 forks source link

Which fields are available? #7

Closed gabrieletassoni closed 8 years ago

gabrieletassoni commented 8 years ago

Hello, I'm testing this gem with GCM, using on the device the GCM QuickStart, in the notification created I use, as data an hash like this:

data: { message: self.title }

It correctly sends the notification, which is displayed on the android device, I was looking for a way to set the title and the icon, but can't seem to find one, I tried something like:

data: { title: "This Title", message: self.title }

but it just shows the message? What am I missing?

thank you for the answer, Gabriele

calonso commented 8 years ago

Hi @gabrieletassoni. Rails push notifications gem uses Ruby Push Notifications to build notifications. In the particular case of GCM the data is appended here: https://github.com/calonso/ruby-push-notifications/blob/master/lib/ruby-push-notifications/gcm/gcm_notification.rb#L26 which means that whichever thing you append there should be delivered.

Let me know if you need any further help or you figured out already. Cheers!

gabrieletassoni commented 8 years ago

Many thanks for the answer and the good direction, I'll dig more into the payload to be sent and how to manage it client side, I'm using the GCM demo provided by Google, which I think it manages just the :message key, I'll experiment with it to show custom payload fields.

Thanks again, Gabriele

calonso commented 8 years ago

Ok, that's great.

Let me know if you need anything else and I'll be happy to help.

PS: Once you work out how to add them, could you please add an example to this thread should someone else find it useful? Also an update of the gem's docs/examples would he lovely.

Regards

gabrieletassoni commented 8 years ago

Yes, for sure! ^_^ In a couple of days I’d manage to code again on that project and hopefully report back here.

Bye.

Il giorno 29 gen 2016, alle ore 11:26, Carlos Alonso notifications@github.com ha scritto:

Ok, that's great.

Let me know if you need anything else and I'll be happy to help.

PS: Once you work out how to add them, could you please add an example to this thread should someone else find it useful? Also an update of the gem's docs/examples would he lovely.

Regards

— Reply to this email directly or view it on GitHub https://github.com/calonso/rails-push-notifications/issues/7#issuecomment-176683199.

calonso commented 8 years ago

Closing issue as stale. Any update @gabrieletassoni??

Please reopen when you're ready.