I am developing an android application that includes gcm push notifications via ti.cloudpush module. I would like to launch specific windows for certain type of push notifications. Is theere any proper way to acieve this. Following are my workouts.
CloudPush.addEventListener('callback', function(evt) {
alert("Notification received: " + evt.payload);
//-------------------launch code
var win=Ti.UI.createWindow({
url:'music.js',
exitOnClose:true,
});
});
i also tried by creating pending intent.It was also not failure. thanks in advance
In the callback you'll have a payload sent back.
The payload is a JSON string of your data payload. Use JSON.parse to turn this in to an object you can use.
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
You can use this payload to base the check on what intent, window or action you would like to fire.
Inside your callback eventEventLister from cloudPush once you have parsed the payload you could load something similar to this:
If you want to switch out a different window, set the url object in the intent to a custom variable that is set depending on what the evt.payload is that's sent back.
eg