繁体   English   中英

离子推送通知在Android设备上不起作用

[英]Ionic push notification not working on android device

我已经开始使用推送通知,并且在使用dev_push=true时一切正常。 但是,当我设置dev_push=false ,我无法使它工作。 奇怪的是,似乎我的设备无法正确识别。 在chrome控制台中,该日志出现两次: $ionicPush:REGISTERED *token-value*

我注册到$cordovaPush:tokenReceived事件,如下所示:

$rootScope.$on('$cordovaPush:tokenReceived', function(event, data) {
    console.debug('Ionic Push: Got token ', data.token, data.platform);
});

而且我看到该事件发送了两次-一次通过平台ios发送,一次通过android发送,

当我从离子仪表板发送一次通知时,什么也没发生。 检查消息状态给出了以下信息:

{"app_id":"4f0867d9","status":"Failed","ios":{"sent":0,"success":false,"failure_reason":"Push Error Code 302: See http://docs.ionic.io/docs/push-error-codes for more info."},"errors":[]}

任何人都知道可能是什么问题以及如何解决?

如果它不能正常工作,请尝试使用POSTMAN

如何使用邮递员

                           POSTMAN

//使用ionic io open launch postman测试是否正确配置了// //然后执行以下操作:

1-create collection give it a valid name
2-in body click on text and select Application/json
it will add header automatically
3-add another header     
key as Authorization
value as Bearer followed by your api token from ionic io
4-select "raw " as the format of our json
2-in body section of your collection write
following code
{
"tokens": ["DEV_DEVICE_TOKEN"],
    "profile": "PROFILE_NAME",
    "notification":
     {
    "message": "This is my demo push!"
     }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM