Hello, i have a tabbed application. I create a notification in status bar when user taps the home button and the app goes to the background. Now i want when the user clicks the notification in status bar, to resume the app from where he was (just like when choosing the app from app manager). I read many examples but i couldn't make it work. Here is some of the code
$.tabGroup.addEventListener('open', function(e) { var activity = $.tabGroup.activity; // onPause activity.addEventListener('pause', function() { // Intent object to launch the application var intent = Ti.Android.createIntent({ action: Ti.Android.ACTION_MAIN, flags : Ti.Android.FLAG_ACTIVITY_CLEAR_TOP | Ti.Android.FLAG_ACTIVITY_SINGLE_TOP, className : 'com.company.myapp.myAppActivity', }); intent.addCategory(Ti.Android.CATEGORY_LAUNCHER); // Create a PendingIntent to tie together the Activity and Intent var pending = Titanium.Android.createPendingIntent({ activity: Ti.Android.currentActivity, intent : intent, flags : Titanium.Android.FLAG_UPDATE_CURRENT, type: Ti.Android.PENDING_INTENT_FOR_ACTIVITY }); // Create the notification var notification = Titanium.Android.createNotification({ icon : "/images/appicon.png", contentTitle : 'My App Name', contentText : 'Click to return to the application.', contentIntent : pending, flags: Ti.Android.FLAG_ONGOING_EVENT | Ti.Android.FLAG_NO_CLEAR }); Titanium.Android.NotificationManager.notify(1, notification); } }At the moment, notification created successfully BUT when i tap the notification the app does not resume, but starts from scratch. I tried many flags in the
createIntent(), createPendingIntent(), createNotification() but couldn't make it work. Which are the correct flags? Do i need to make changes in tiapp.xml file? Is the place i make and call notification wrong (inside tabGroup's 'open' eventListener and inside activity's 'pause' eventListener)? Is there any working example that creates and resumes app from notification in status bar?