Telerik-Verified-Plugins / LocalNotification

Apache License 2.0
21 stars 27 forks source link

Error on Android when define option 'json' #3

Closed leonardobsantuci closed 8 years ago

leonardobsantuci commented 9 years ago

When I call the add method passing some data in the option json, like below:

window.plugin.notification.local.add({ 
    message: 'lorem ipsum', 
    json: JSON.stringify({ key1: "value1", key2: 2 })
});

I have an error "Uncaught SyntaxError: Unexpected identifier". Despite this error, the notification is triggered, but my callback function for the event 'ontrigger' is not called and I can't get the value passed in the option 'json' as wanted.

window.plugin.notification.local.ontrigger = function (id, state, json) {
                var data;
                if ( json ) {
                    data = JSON.parse(json);
                    console.log(data.key1);
                }
            };

The problem occurs only in Android, on iOS it is working perfectly.

EddyVerbruggen commented 9 years ago

Hi, I've seen bugreports like this in the upstream repository, so I investigated a little. I've applied a fix and released a 0.8.0dev3 version. Can you please verify this fixes the problem for you?