2016-07-01 2 views
0

매개 변수 - v2.1.2 :푸시 알림이 나는 자바 스크립트 SDK를 사용하고

내 쿼리 : 자바 스크립트를 사용하여 안드로이드 장치에서 사용자 정의 GCM 매개 변수로 푸시 알림을 전송하는 방법.

자바 스크립트 코드로 Android 기기에 푸시 알림을 보내려고하지만 Google에서는 앱에 CleverTap이라는 타사 수신자를 사용하고 있습니다. CleverTap 수신기에 대한 필수 매개 변수는 다음과 같습니다 "wzrk_sound" "NT" "wzrk_pn" "을 나노" "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 
    }] 
} 

내가 친절이 좀 도와 내 실수를 수습 할 수없는입니다.

나쁜 영어로 죄송합니다. 난 최선을 다 했어.

답변

0

필요에 따라 솔루션을 얻을 수 없어 GCM 수신기를 변경했습니다.

관련 문제