Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"service":"*MyService*","requestCode":42,"repeat":"yearly","year":2017,"month":6,"day":26,"hour":6,"minute":0,"second":0}
- var service = Ti.Android.currentService;
- var serviceIntent = service.getIntent();
- setNotification();
- Ti.Android.stopService(serviceIntent);
- function setNotification(alarm) {
- var activity = Ti.Android.currentActivity;
- var intent = Ti.Android.createIntent({
- action : Ti.Android.ACTION_MAIN,
- className : 'myActivity',
- flags : Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED |
- Ti.Android.FLAG_ACTIVITY_SINGLE_TOP
- });
- intent.addCategory(Titanium.Android.CATEGORY_LAUNCHER);
- var pending = Ti.Android.createPendingIntent({
- activity : activity,
- intent : intent,
- type : Ti.Android.PENDING_INTENT_FOR_ACTIVITY,
- flags : Ti.Android.FLAG_ACTIVITY_NO_HISTORY
- });
- //var message = "Time is up!";
- var notificationOptions = {
- contentIntent : pending,
- contentTitle : 'Titel',
- contentText : 'Alles Gute zum Geburtstag!',
- tickerText : 'Herzliche Glückwünsche',
- icon : Titanium.App.Android.R.drawable.ic_stat_cake,
- flags : Titanium.Android.FLAG_AUTO_CANCEL |
- Titanium.Android.FLAG_SHOW_LIGHTS | Titanium.Android.FLAG_INSISTENT,
- };
- var notification = Ti.Android.createNotification(notificationOptions);
- Ti.Android.NotificationManager.notify(1, notification);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement