android - Started activity from home key screen -


i have background service starts activity,

intent = new intent(this, myactivity.class); i.addflags(intent.flag_activity_new_task); startactivity(i); 

after destroying activity , restart on "long press home key menu", activity starts again. want start main activity instead. how realise this?

could explain in more detail? if understand problem try setting flag_activity_no_history.

alternatively manual solution check flag_activity_launched_from_history on intent in myactivity , launch main activity if see flag set. following code should that:

if ((getintent().getflags() & flag_activity_launched_from_history) > 0) {    activity.startactivity(new intent(context , mainactivity.class).addflags(intent.flag_activity_clear_top));     } 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -