1
votes

I am using urban airship for sending push notification, i finished all configuration in my app and i can send notification from urban airship website.

Now i have to request urban airship api for sending push notification (using this " https://go.urbanairship.com/api/push/") URL and i have send json like this

{
    "apids": [
        "some APID",
        "another APID"
    ],
    "aliases": ["my_alias"],
    "tags": ["tag1", "tag2"],
    "android": {
         "alert": "Hello from Urban Airship!",
         "extra": {"a_key":"a_value"}
    }
}

i want to send push notification for single device, i have to do this using APID, isn't it?.

what is APID?

EDIT

This groovy push request code

@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.0' )
import groovyx.net.http.*
import static groovyx.net.http.ContentType.*
import static groovyx.net.http.Method.*

       def http = new HTTPBuilder('https://go.urbanairship.com')
       http.request( POST ) {
         uri.path = '/api/push/'
         body = [android: 'alert: You have reply', apids: 'some apid']
         requestContentType = ContentType.JSON

         response.success = { resp ->
           println "Success! ${resp.status}"
         }
       }

But it's not working?

1
define "i think this APID not working after some time" (define "not working", define "i think", define "some time". Also, what do you mean "what is the request format" ? isn't it, like, a simple post ? - njzk2
i want to send push notification for single device,i have to do this using APID, isn't it?. - Viswa

1 Answers

1
votes

APID will generate when a device trying to register(unique id for every device), using APID we can send push notification to particular device.

how to send request to Urban airship is explained here, Java code for sending request to urban airship