Force relaunch of an activity Android -
i have activity in app can opened notification. content of activity depends on kind of notification. example : if receive 'a notification', app launch activity , 1 displays 'a received'. then, if receive 'b notification', app launch activity again , displays 'b received'. probleme when activity has been launched once, when 'b notification' relaunch again, activity still displays 'a received'. how force activity re-create depending on intent received?
i tried intent.setflags(intent.flag_activity_new_task | intent.flag_activity_clear_top); doesn't work.
thanks !
edit : after research, i've found out pendingindent problem. seems intent passed parameter in pendingintent.getactivity(ctx, 0, intent, 0)
wasn't updated. added
intent.setaction(long.tostring(system.currenttimemillis()));
and worked charm.
finish existing activity in 'a' or 'b' notification handler before starting activity.
Comments
Post a Comment