android - ongoing notification opening existing Activity -
i want show notification while timer running , when user clicks notifiaction opens timer activity.
mnotificationmanager = (notificationmanager) getsystemservice(context.notification_service); intent intent = new intent(this, activity.class).addflags(intent.flag_activity_reorder_to_front); pendingintent pendingintent = pendingintent.getactivity(this, 0, intent, pendingintent.flag_update_current);
the problem right when start timer , press home , click notification opens activity running timer.
but when start timer, open activity (via actionbar.navigation_mode_list
), press home , click notification opens new activity (empty).
i thought addflags(intent.flag_activity_reorder_to_front);
(thats used navigate between activities)
im using android:launchmode="singletop"
, android:configchanges="orientation|screensize"
for every activity.
i wouldn't rely on activity persisting , unnecessary
store timer start time sharedpreferences , load start time when activity recreated.
if meant happen after time, countdown time, you'll need set alarm , handle way.
remember activities ui. don't trust activity doing when user isn't looking @ it.