在Android上解析推送通知

 手机用户2502941293 发布于 2023-02-14 00:40

我正在创建一个将使用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" }**

提前感谢任何帮助/想法

1 个回答
  • 您应该从网站parse.com上的解析设置打开推送通知

    应用程序 - >设置 - >推送通知 - >启用客户端推送(应该打开)

    2023-02-14 01:05 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有