Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

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 notification

    alert(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!


  • Monaca

    @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!


  • Monaca

    @jamal

    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!