我正在创建一个将使用Parse.com推送通知的应用程序,但它不像指南显示那样工作.
问题是,我已经设置了Parse推送活动,注册了新安装,并且能够看到用户订阅了哪些频道.我能够从解析中收到推送通知,但无法从我的应用程序发送.
在logcat中没有错误,并解析了发送推送的记录,但显示该通道没有"订阅者".
在我的onCreate中:
Parse.initialize(MainActivity.this, "***", "***"); PushService.setDefaultPushCallback(this, MainActivity.class); PushService.subscribe(this, "Everyone", MainActivity.class); ParseInstallation.getCurrentInstallation().saveInBackground();
推送代码:
ParsePush push = new ParsePush(); push.setChannel("Everyone"); push.setMessage("Hey!"); push.sendInBackground();
清单:
....
在logcat中没有错误,一切似乎都顺利发送,但在解析时我得到以下消息:
我的推动
You sent this push notification to 0 recipients. Targeting : channels includes "Everyone" Sending date : November 28th, 2013 at 9:40 AM Expiration : None Full target : { "channels": { "$in": [ "Everyone" ] } } Full data : {"alert"=>"Hey!"}
我发送的推送与parse.com发送的推送的唯一变化是"完整数据"字段
解推
Targeting : channels includes "Everyone" deviceType is "android" Sending date : November 28th, 2013 at 9:21 AM Expiration : None Full target : { "channels": { "$in": [ "Everyone" ] }, "deviceType": "android" } **Full data : { "alert": "hi" }**
提前感谢任何帮助/想法
您应该从网站parse.com上的解析设置打开推送通知
应用程序 - >设置 - >推送通知 - >启用客户端推送(应该打开)