android notification launches same activity twice -
when click notification on status bar launches activity behavior strange. if app in foreground , click notification notification intent fired once. if app in background notification intent fired twice. if exit app (ie activities have been popped hitting button) notification intent fired once. can explain behaviour. code snippet follows:
_notification = new notification(icon_id, "ticker text", system.currenttimemillis()); _showactivityintent = new intent(); _showactivityintent.setaction(myactivityname); _showactivityintent.setflags(intent.flag_activity_new_task + intent.flag_activity_no_history); _showactivitypendingintent = pendingintent.getactivity(context, 0, _showactivityintent, 0); _notification.setlatesteventinfo(context, "my title", "my text", _showactivitypendingintent); _notificationmgr.notify(notificationid, _notification);
_showactivityintent.setflags(intent.flag_activity_clear_top);
try this. prevent multiple instances of same activity. u can put in manifest also
Comments
Post a Comment