Push notification extra_json items are not available in monaca.cloud.Push.setHandler
-
Hi,
Now we’ve got the documentation issue resolved, I am passing extra_json in a push notification request
extra_json : {“test” : “1234”}
as in:
{
“jsonrpc”: “2.0”,
“method”: “Push.send”,
“params”:{
“pushProjectId”: “appprojectid goes here - removed”,
“platform”: “android”,
“target”: “app”,
“buildtype”: “release”,
“title”: “Hello”,
“message”: “just testing”,
“extra_json”: { “test”:“1234” }
},
“id”:1
}In mobile app, I have:
monaca.cloud.Push.setHandler(function(data) {
// JSON data within push notificationalert(data.test);
});
However, the data.test is displayed as undefined. Please advice where the issue is.
Do you have a working sample about push notification? I have not found any.
Thanks!
-
@jamal Can you try to test this again? I successfully received the json data.
-
@khmery, it is not working for me. I am getting a blank object with 0 keys!
What is the RPC request you sent and what code did you write in the monaca.cloud.Push.setHandler() ?
Thanks!
-
My request and
setHandler
function are the same as yours. The way you wrote it is correct. Would you please try again? I was told that there was a glitch in the server side yesterday. I tested again today and it works fine.
-
@khmery, finally it is working.
Keep it up. Thanks a lot!