android - Waze-like notification icon that returns to app -


i'm trying add notification icon application, function waze's notification icon - when open status bar , tap on "return myapp" line, application move foreground - same activity stack state had when moved background.

i went on numerous questions, , found lot of answers if know in advance activity going shown when notification tapped. don't know activity it's going - can of app's activities.

i tried sending broadcast when notification tapped. can broadcast in receiver alright, there i'm stuck exact same problem - don't know activity launch - can't find last activity (i can find last task, since app has 1 task, it's no help).

you need create pending intent.

like this:

intent notifyintent = new intent(context, chat.class);

pendingintent intent = pendingintent.getactivity(chat.this, 0, notifyintent, simple_notfication_id); notifydetails.setlatesteventinfo(context, contenttitle, contenttext, intent); notifyintent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top);  mnotificationmanager.notify(simple_notfication_id, notifydetails); 

please see link

sample project

related


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -