app.js
// this sets the background color of the master UIView (when there are no windows/tab groups on it) Ti.UI.setBackgroundColor('#000'); //Add this in so Titanium will add the permission for us. Titanium.Media.vibrate(); //Add this so Titanium will add the permissions and links needed to play sounds var sound = Titanium.Media.createSound(); //Bring in the module var alarmModule = require('bencoding.alarmmanager'); //Create a new instance of the Alarm Manager var alarmManager = alarmModule.createAlarmManager(); //Create our basic window to put our example buttons on var win = Titanium.UI.createWindow({ title:'Tab 1', backgroundColor:'#fff', title:'Alarm Manager Tests' }); var btn5 = Ti.UI.createButton({ title:"Alarm & Service Basic", top:180, left:5, width: 150, height:75 }); win.add(btn5); var now = new Date(); btn5.addEventListener('click',function(e){ alarmManager.addAlarmService({ //The full name for the service to be called. Find this in your AndroidManifest.xml Titanium creates service:'com.appworkbench.alarmtest.TestserviceService', year: now.getFullYear(), month: now.getMonth(), day: now.getDate(), hour: now.getHours(), minute: now.getMinutes() + 1, //Set the number of minutes until the alarm should go off interval:60000, // Create an interval service that runs each minute, repeat:'weekly', //You can use the words hourly,daily,weekly,monthly,yearly or you can provide milliseconds. //Or as shown above you can provide the millesecond value }); var ew = Ti.UI.createAlertDialog({ title:'Info', message:"The Service provided will be started in about 2 minutes", buttonNames:[Ti.Android.currentActivity.getString(Ti.Android.R.string.ok)] }); ew.show(); }); win.open();testservce.js
var service = Ti.Android.currentService; var serviceIntent = service.getIntent(); setNotification(); Ti.Android.stopService(serviceIntent); var today = new Date(); var d = new Date("April 21, 2015 01:15:00"); var diff = d.getTime() - today.getTime(); var days=500- Math.round(diff / (1000 * 60 * 60 * 24)); var weeksdone=Math.floor(days/ 7); var week=Math.abs(weeksdone); function setNotification(alarm){ var activity = Ti.Android.currentActivity; var intent = Ti.Android.createIntent({ action: Ti.Android.ACTION_SENDTO, url : 'app.js', flags : Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Ti.Android.FLAG_ACTIVITY_NEW_TASK, data:weeksdone, type:'text/plain' }); 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 = weeksdone; var notificationOptions = { contentIntent : pending, contentTitle : "weeks done"+weeksdone, contentText : message, tickerText :message, when : new Date().getTime(), icon : Ti.App.Android.R.drawable.appicon, flags : Titanium.Android.FLAG_AUTO_CANCEL | Titanium.Android.FLAG_SHOW_LIGHTS | Titanium.Android.FLAG_INSISTENT, // sound: Ti.Filesystem.getResRawDirectory() + 'sound' }; var notification = Ti.Android.createNotification(notificationOptions); Ti.Android.NotificationManager.notify(1, notification); Ti.Media.vibrate([0,100,100,200,100,100,200,100,100,200]); }what i want to do is get notification with the weeks done in the notificationoptions ..but i am getting undefined... android titanium sdk 3.3.0