【问题标题】:Unable to receive push notifications using QuickBlox无法使用 QuickBlox 接收推送通知
【发布时间】:2016-04-02 06:58:47
【问题描述】:

我正在尝试从 web (Javascript) 发送推送,推送消息已成功添加到 quickblox 帐户的队列中,状态为已发送,但我没有在设备 (iPhone) 上收到它。当我从 Web 控制台发送推送时,我能够成功接收它。请告诉我代码有什么问题或需要任何设置。

发送push的代码如下:

var params = {
                login: .....,
                password: .....
            }
QB.createSession(params, function(err, result) {
                if(!err){

                    var pushCustomParams = {
                        message: 'Message sent successfully',
                        ios_badge: 1,
                        ios_sound: 'ringtone.wav',
                        user_id: app.caller.id

                    }

                    var params1 = {
                        notification_type: 'push',

                        user: {ids: [recp_id]}, // recipients.
                        environment: 'development', // environment, can be 'production' as well.
                        message: QB.pushnotifications.base64Encode(JSON.stringify(pushCustomParams)) // See how to form iOS or Android spesific push notifications
                    };

                    QB.pushnotifications.events.create(params1, function(err, response) {
                        if (err) {
                            console.log(err);

                        } else {
                            // success


                        }
                    });
                }
            });

【问题讨论】:

    标签: javascript push-notification quickblox


    【解决方案1】:

    试试这样:

    var params1 = {
        notification_type: 'push',
        push_type: 'apns', // http://quickblox.com/developers/Messages#Create_event
        user: {ids: [recp_id]},
        environment: 'development',
        message: QB.pushnotifications.base64Encode(JSON.stringify(pushCustomParams))
    };
    

    我希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-09
      相关资源
      最近更新 更多