0
как запустить код при нажатии пользователем на уведомление? если пользователь нажимает push-уведомление, я хочу понять, что происходит из push-уведомления.Titanium с тем, как запускать некоторый код, когда пользователь нажимает на уведомление? (Android)
Как я могу это сделать?
Благодаря -Gcm // Модуль-мой гсм модуль вар гсм = требуется ("nl.vanvianen.android.gcm");
/* If the app is started or resumed act on pending data saved when the notification was received */
var lastData = gcm.getLastData();
if (lastData) {
Ti.API.info("Last notification received " + JSON.stringify(lastData));
gcm.clearLastData();
}
gcm.registerPush({
senderId : 'xxxxxxxx',
notificationSettings : {
sound : 'mysound.mp3',
smallIcon : 'notification_icon.png',
largeIcon : 'appicon.png',
vibrate : true
},
//Push registration success
success : function(event) {
Ti.API.info("Push registration success: " + JSON.stringify(event));
},
//Push registration error
error : function(event) {
Ti.API.info("Push registration error = " + JSON.stringify(event));
alert(event.error);
},
//i want this function Coming from push
data : function(event) {
// console.log(" ******* Coming from push : " + JSON.stringify(event));
},
//my callback funtion call device token
callback : function(event) {
Ti.API.info("Push callback = " + JSON.stringify(event));
var dialog = Ti.UI.createAlertDialog({
title : 'Push received',
message : JSON.stringify(event.data)
// buttonNames: ['View'],
// cancel: 1
});
dialog.addEventListener("click", function(event) {
dialog.hide();
if (event.index == 0) {
/* Do stuff to view the notification */
}
});
dialog.show();
},
});
Он также успешно на нажимной уведомления Appcelerator панели идет в одну сторону, но не означает, что устройство. что мне делать? – KaraEski