【问题标题】:Ionic push notification not working on android device离子推送通知在安卓设备上不起作用
【发布时间】:2015-11-16 06:53:00
【问题描述】:

我已经开始使用推送通知,使用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,

当我从 ionic 仪表板发送一次性通知时,什么也没发生。检查消息状态给出了这个:

{"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":[]}

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

【问题讨论】:

    标签: android push-notification ionic


    【解决方案1】:

    如果从那里无法正常工作,请尝试使用 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!"
         }
    }
    

    【讨论】:

    • 如果您还有其他问题,请点击 按钮进行提问。
    猜你喜欢
    • 1970-01-01
    • 2016-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-01
    相关资源
    最近更新 更多