パラメータ - v2.1.2:プッシュ通知は、私には、JavaScript SDKを使用しています
マイクエリ:JavaScriptを使用してAndroidデバイスでカスタムGCMパラメータでプッシュ通知を送信する方法。
私はJavaScriptコードでアンドロイドデバイスにプッシュ通知を送信しようとしていますが、アプリではCleverTapと呼ばれるサードパーティレシーバを使用しています。 CleverTap受信機のための必須パラメータは次のとおりです。 「wzrk_sound」 「NT」 「wzrk_pn」 「をnm」で 「wzrk_dl」私はカスタムパラメータとして送信する必要があり。続き
は、プッシュ通知のための私のコードです:上記のコードを実行した後に生成
var pushCustomParams = {
message: 'Message received from Bob',
wzrk_pn: 1,
wzrk_sound: 1,
nt: 'Revofit',
nm: 'This msg is from application',
wzrk_dl: ''
}
var params = {
notification_type : 'push',
push_type : 'gcm', // 'gcm' is for Android, 'apns' - for iOS.
user : { ids: [14411551] }, // 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(params, function(err, response) {
if (err) {
console.log(err);
} else {
// success
console.log(response);
}
});
ログは次のとおりです。
{
"notification": {
"registration_ids": ["dFCRdN7MJD0:APA91bFsaOdorqhvRyMuUGH-Ds8Z_EB6pQWHpQIYy5YVUefwYFwqK39E5BsLtJ2cHYDLv9mPXDQc4mAQRhJTdM2unUgy6-kmWSWMorp0ZSbBL1EdjFZLiorh4LQT3JR454dqEP1bL2_l"],
"delay_while_idle": false,
"data": {
"message": "{\"message\":\"Message received from Bob\",\"wzrk_pn\":1,\"wzrk_sound\":1,\"nt\":\"Revofit\",\"nm\":\"This msg is from application\"}",
"collapse_key": "event7637817"
},
"priority": "high",
"time_to_live": 86400
},
"log": [{
"device_token": null,
"created_at": "2016-06-30T14:26:46Z",
"delivered_at": "2016-06-30T14:26:47Z",
"failed_at": null,
"error_code": null,
"error_description": null
}]
}
しかし、ときに私は私で管理パネルからのプッシュ通知を送信しようとしましたカスタマイズされたGCMパラメータのチャンネル設定はうまくいきました。 ログは、管理パネルからの通知を生成:
{
"notification": {
"registration_ids": ["eShiPWpBngA:APA91bFzFeaB0LryAt9FmEJ9xl2KHWhZWlfzpYhng4KONN60yr3ySl2R58Eye-qSmhzQ56T2Fyuzr0Yg4y1VWMIm20LH74U7BWO_Az7MgogBD2IGvmWEKvJWWgVH6sD-3wP_gaIgJEAY"],
"delay_while_idle": false,
"data": {
"message": "hii",
"wzrk_pn": "1",
"nm": "New message",
"nt": "revofit",
"collapse_key": "event7632938"
},
"priority": "high",
"time_to_live": 86400
},
"log": [{
"device_token": null,
"created_at": "2016-06-30T08:17:25Z",
"delivered_at": "2016-06-30T08:17:26Z",
"failed_at": null,
"error_code": null,
"error_description": null
}]
}
は、私は親切にこれで私を助けて 私のミスを修正することができません。
私の悪い英語を申し訳ありません。最善を尽くした。