What is the best way to send push notifications through Urban AirShip using a Rails 3 web app?
From Urban Airship documentation:
An HTTP POST to /api/push/broadcast/
sends the given notification to all
registered device tokens for the
application. The payload is in JSON
with content-type application/json,
with this structure:
{
"aps": {
"badge": 15,
"alert": "Hello from Urban Airship!",
"sound": "cat.caf"
},
"exclude_tokens": [
"device token you want to skip",
"another device token you want to skip"
]
}
I really don’t know where to start!
Better way is to use UrbanAirship Groupon version. Their docs specify every thing very clearly and it will much neater code. Worked and tested in my application.
From the read me file, (with some more comments and all):-
Note: if you are using Ruby 1.8, you should also install the system_timer gem for more reliable timeout behaviour. See http://ph7spot.com/musings/system-timer for more information. Baically
Installation
Configuration define all this in initializes directory and then make sure u restart your application.
Usage
Registering a device token
Unregistering a device token
Sending a push notification (for instant delivery remove schedule_for attribute)
Batching push notification sends (for instant delivery remove schedule_for attribute)
Sending broadcast notifications
Urbanairship allows you to send a broadcast notification to all active registered device tokens for your app.(for instant delivery remove schedule_for attribute)