When I click on my status bar notification 开发者_如何学Cit loads my webview, but it reloads it everytime. is there a way to load the saved state? Thanks here is what I have:
@Override
public void onStart(Intent intent, int startid) {
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.notification_icon;
CharSequence tickerText = "Now playing...";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
Context context = getApplicationContext();
CharSequence contentTitle = "Music Promotion";
CharSequence contentText = "Now Playing...";
Intent notificationIntent = new Intent(this, mainmenu.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(HELLO_ID, notification);
}
add the following:
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
This is what the docs say about FLAG_ACTIVITY_REORDER_TO_FRONT
:
If set in an Intent passed to Context.startActivity(), this flag will cause the launched activity to be brought to the front of its task's history stack if it is already running.
i changed the launch mode in the android manifest to singleInstance and that seemed to have done the trick
精彩评论