Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. {"service":"*MyService*","requestCode":42,"repeat":"yearly","year":2017,"month":6,"day":26,"hour":6,"minute":0,"second":0}
  2.  
  3. var service = Ti.Android.currentService;
  4. var serviceIntent = service.getIntent();
  5.  
  6. setNotification();
  7.  
  8. Ti.Android.stopService(serviceIntent);
  9.  
  10. function setNotification(alarm) {
  11. var activity = Ti.Android.currentActivity;
  12. var intent = Ti.Android.createIntent({
  13. action : Ti.Android.ACTION_MAIN,
  14. className : 'myActivity',
  15. flags : Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED |
  16. Ti.Android.FLAG_ACTIVITY_SINGLE_TOP
  17. });
  18. intent.addCategory(Titanium.Android.CATEGORY_LAUNCHER);
  19.  
  20. var pending = Ti.Android.createPendingIntent({
  21. activity : activity,
  22. intent : intent,
  23. type : Ti.Android.PENDING_INTENT_FOR_ACTIVITY,
  24. flags : Ti.Android.FLAG_ACTIVITY_NO_HISTORY
  25. });
  26.  
  27. //var message = "Time is up!";
  28.  
  29. var notificationOptions = {
  30. contentIntent : pending,
  31. contentTitle : 'Titel',
  32. contentText : 'Alles Gute zum Geburtstag!',
  33. tickerText : 'Herzliche Glückwünsche',
  34. icon : Titanium.App.Android.R.drawable.ic_stat_cake,
  35. flags : Titanium.Android.FLAG_AUTO_CANCEL |
  36. Titanium.Android.FLAG_SHOW_LIGHTS | Titanium.Android.FLAG_INSISTENT,
  37. };
  38.  
  39. var notification = Ti.Android.createNotification(notificationOptions);
  40. Ti.Android.NotificationManager.notify(1, notification);
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement