Skip to content

Instantly share code, notes, and snippets.

@nowelium
Created July 26, 2011 06:25
Show Gist options
  • Save nowelium/1106112 to your computer and use it in GitHub Desktop.
Save nowelium/1106112 to your computer and use it in GitHub Desktop.
Android Notification re-launching
var activityClassName = Ti.App.id + '.' + Ti.App.name.substring(0, 1).toUpperCase() + Ti.App.name.substring(1) + 'Activity';
var intent = Titanium.Android.createIntent({
//className: 'org.appcelerator.titanium.TiActivity',
//packageName: Ti.App.id,
className: activityClassName,
action: Titanium.Android.ACTION_MAIN,
flags: 0x10200000
});
intent.addCategory(Titanium.Android.CATEGORY_LAUNCHER);
var pending = Titanium.Android.createPendingIntent({
activity: Titanium.Android.currentActivity,
intent: intent,
//ype: Titanium.Android.PENDING_INTENT_FOR_ACTIVITY,
flasgs: 0x10200000
});
var notification = Titanium.Android.createNotification({
// appicon
icon: 0x7f020000,
contentIntent: pending,
contentTitle: 'title is here',
contentText: 'text is here',
tickerText: 'ticket is here',
});
Titanium.Android.NotificationManager.notify(1, notification);
@anfaguerrero
Copy link

this work even when app is paused?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment