Closed somefakeuser closed 9 years ago
To securely get the "decoded" JSON payload, try to use something like:
var dataContainer = (OS_ANDROID) ? event.data.data : event.data;
var payload = (typeof dataContainer === "object") ? dataContainer : JSON.parse(dataContainer);
alert('Notification: ' + payload.alert);
Regards,
Arley
This is for android.
so I looked at what Ti.API.info('eventCallback:' + JSON.stringify(event)); outputs and a get this:
Now when i use iOS, i simple open an alertbox and display JSON.stringify(event.data.alert); and it works. BUT with android and looking at the JSON output above, it seems that i will always get undefined because event.data.alert does not exist.
So my question is, what do I need to call to get Android's alert message from the event?
Hope I made sense. Thanks very much.