I try send data to gcm and in client side receive it. every things is work and push is receive but data filed is null, try with postman like this :
URL: https://android.googleapis.com/gcm/send
Headers:
Authorization: key=<your-api-key>
Content-Type: application/json
Body
{
"collapse_key": "score_update",
"time_to_live": 108,
"delay_while_idle": true,
"data": {
"key1": "value1",
"key2": "value2"
},
"registration_ids":["eaFbvFT64EQ:APA91bEfdq8QDTU2XbQ3V1bhC5UnMz2ZKWUQokq3Ta79Vg_2-Z8rnI6MFCxko6hVt3EoSQoqa24-ddjy8iSbxoP36rvXoGcPqsMQWFjzM5mz6K8tPbfoL2zEEfDxvcXajlb_-vw2vmpv"]
}
this way work and send push to client with registration_ids but data filed is null.
and try with another way with to instead of registration_ids like this :
{
"to":"eaFbvFT64EQ:APA91bEfdq8QDTU2XbQ3V1bhC5UnMz2ZKWUQokq3Ta79Vg_2-Z8rnI6MFCxko6hVt3EoSQoqa24-ddjy8iSbxoP36rvXoGcPqsMQWFjzM5mz6K8tPbfoL2zEEfDxvcXajlb_-vw2vmpv",
"data": {
"key1": "value1",
"key2": "value2"
}
}
and like last way push is receive with null data
I find https://github.com/gauntface/simple-push-demo project and implement it. this project work very well but in this project payload data is encrypted like this :
Headers:
Authorization: key=<your-api-key>
Content-Type: application/json
Encryption: salt=L_da9h_5eIPS1c0gNV3fOQ
Crypto-Key: dh=BPDpQTlRDuk8DBFB3LxuTSnevgZGla7g8-LrTRSvUkPiU_ZsQVppocib1lFTYKP33bENL_gaMahaEXinMuYwu-c
Body
{
"to":"fE5h8Q6gtno:APA91bEO-_LLDOIGMStAxR9J58RwA5fOSdvwVKNYkBnq7Xohm5kf-b4Gc4iq6BzrwEIgZxsKb3EKCtAsQgS34sKWpVEzX_gWx7OpCUuzKRqg50zOt2TjMR1KjHYwV3EkiE0BUh6JS-qu",
"raw_data":"NBpw3QkilspdNClRE1k1CYsg1wHT3Q=="
}
question :
1- how to send gcm push message with payload data without encrypt
2- What's the difference between to
param and register_ids
param