Created
December 5, 2012 15:22
-
-
Save alanleard/4216486 to your computer and use it in GitHub Desktop.
Android Local Notification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var intent = Ti.Android.createServiceIntent({url: 'notification.js'}); | |
Ti.Android.stopService(intent); | |
////*notification.js*//////// | |
Titanium.Android.NotificationManager.notify( | |
0, // <-- this is an ID that we can use to clear the notification later | |
Ti.Android.createNotification({ | |
//contentView: customView, | |
contentTitle: "Local Notification", | |
icon:0x7f020000, | |
contentText: "Notification Message", | |
// when: now, | |
tickerText: "This is my ticker message", | |
contentIntent: Ti.Android.createPendingIntent({ | |
intent: Ti.Android.createIntent({ | |
url: 'app.js' | |
}) | |
}) | |
})); | |
var intent = Ti.Android.createServiceIntent({ | |
url: 'notification.js' | |
}); | |
Ti.Android.stopService(intent); | |
intent.putExtra('interval', 24*20*60*1000); | |
Ti.Android.startService(intent); | |
Ti.App.Properties.setInt('notificationCount', 2); | |
} else if(Ti.App.Properties.getInt('notificationCount')==2){ | |
Titanium.Android.NotificationManager.notify( | |
0, // <-- this is an ID that we can use to clear the notification later | |
Ti.Android.createNotification({ | |
//contentView: customView, | |
contentTitle: "Local Notification", | |
icon:0x7f020000, | |
contentText: "Notification Message", | |
// when: now, | |
tickerText: "This is my ticker message", | |
contentIntent: Ti.Android.createPendingIntent({ | |
intent: Ti.Android.createIntent({ | |
url: 'app.js' | |
}) | |
}) | |
})); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment