Ron*_*lev 3 android push-notification urbanairship.com google-cloud-messaging
我正在使用Urban Airship并使用他们的REST API进行测试.我已Google Cloud Messaging连接到Urban Airship帐户,并且已成功注册一个Android设备.
我可以从Urban Airship仪表板上的界面成功发送测试消息.
但是当我尝试https://go.urbanairship.com/api/push/在身体上使用REST API 时
{
"audience" : "all" ,
"device_types" : "all",
"notification" : {
"android": {
"alert" : "This is a broadcast."
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到400 Bad Request回复This app is not configured for iOS push
知道为什么吗?
更新:列出"audience"部分中的特定设备APID返回相同的结果
你拥有的是正确的,但是你需要包含以下HTTP标头:
Accept: "application/vnd.urbanairship+json; version=3;
Run Code Online (Sandbox Code Playgroud)
对于初学Ruby开发人员,可以这样实现:
req = Net::HTTP::Post.new(uri.path)
req["Accept"] = "application/vnd.urbanairship+json; version=3;"
Run Code Online (Sandbox Code Playgroud)
例如,向UrbanAirship发布通知时.