Created
May 16, 2012 22:06
-
-
Save MikeLarned/2714354 to your computer and use it in GitHub Desktop.
UrbanAirship Broadcast
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void Broadcast(string message, Dictionary<string,string> extras) | |
| { | |
| var iosBroadcast = new Dictionary<string, object> {{"aps", new {alert = message}}}; | |
| var androidBroadcast = new {android = new {alert = message}, extra = extras}; | |
| foreach (var kvp in extras) | |
| { | |
| iosBroadcast.Add(kvp.Key, kvp.Value); | |
| } | |
| Http.Post(GetApiUrl("push/broadcast/"), WithMasterSecret, iosBroadcast); | |
| Http.Post(GetApiUrl("push/broadcast/"), WithMasterSecret, androidBroadcast); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| User-Agent: Fiddler | |
| Authorization: Basic <key:mastersecret> | |
| Content-Type: application/json | |
| Content-Length: 125 | |
| Host: go.urbanairship.com | |
| POST - https://go.urbanairship.com/api/push/broadcast/ | |
| iOS Request Body: | |
| { | |
| "aps": { | |
| "alert": "Hello from Urban Airship!", | |
| }, | |
| "url": "http://www.google.com" | |
| } | |
| Android Request Body: | |
| { | |
| "android": { | |
| "alert": "Hello from Urban Airship!", | |
| "extra": {"data":"optional extra data"} | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment