Hello,
I want to show information from the notification in my Android device but I can't do it. I 've tried to parse theJson string without any result. I 've seen some forum anwers but they didn't work from me.
For example this the string that I received from the Appcelerator Studio:
{"android":{"title":"Example Title","sound":"default","alert":"Example alert","vibrate":true}}
This is my code
CloudPush.addEventListener('callback', function (evt) { alert("Notification received: " + evt.payload); var payload = JSON.parse(evt.payload); Ti.API.info("title: " + payload.title); Ti.API.info("alert: " + payload.alert); });On device I can see the alert with success like this:
ALERT Notification received {"android":{"title":"Example Title","sound":"default","alert":"Example alert","vibrate":true}}but in the Console when I want to parse the JSON string, I have this:
[INFO] : title: undefined [INFO] : alert: undefinedI 've tried in many ways with no any success.
I'm Using SDK 4.0.0 GA
Can someone help me
Thank you