【问题标题】:how to send push JSON to urban airship server using api如何使用 api 将推送 JSON 发送到城市飞艇服务器
【发布时间】:2012-11-22 10:43:01
【问题描述】:

我正在使用城市飞艇发送推送通知,我在我的应用中完成了所有配置,我可以从城市飞艇网站发送通知。

现在我必须请求城市飞艇 api 来发送推送通知(使用这个“https://go.urbanairship.com/api/push/”)URL,我已经发送了这样的 json

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

我想为单个设备发送推送通知,我必须使用 APID,不是吗?

什么是 APID?

编辑

这个 groovy 推送请求代码

@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}"
         }
       }

但它不起作用?

【问题讨论】:

  • define "i think this APID not working after some time" (define "not working", define "i think", define "some time". 另外,你的意思是“什么是请求格式”?不就是一个简单的帖子吗?
  • 我想为单个设备发送推送通知,我必须使用 APID,不是吗?

标签: android sencha-touch push-notification urbanairship.com


【解决方案1】:

当设备尝试注册时会生成 APID(每个设备的唯一 ID),使用 APID 我们可以向特定设备发送推送通知。

这里解释了如何向 Urban 飞艇发送请求, Java code for sending request to urban airship

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多