android - onNewIntent is not being called - only every second time? -


i have notification setting up

intent intent = new intent(ctx, mainactivity.class); intent.setflags(intent.flag_activity_new_task | intent.flag_activity_no_history);  pendingintent pi = pendingintent.getactivity(ctx, 0, intent, pendingintent.flag_update_current); mbuilder.setcontentintent(pi);  mnotificationmanager.notify(mainactivity.notification_result, mbuilder.build()); 

when notification, mainactivity.onnewintent() getting called every second time reason. have debug log statement in there, , literally every 2nd time, log not trigger.

any thoughts?

i not sure requirements, onnewintent declare in docs

this called activities set launchmode "singletop" in package, or if client used flag_activity_single_top flag when calling startactivity(intent). in either case, when activity re-launched while @ top of activity stack instead of new instance of activity being started, onnewintent() called on existing instance intent used re-launch it.

since not using single_top flag, behavior might inconsistent.

in case, onnewintent purpose send new intent activity running. so, if activity not running , click on notification launch it, not call onnewintent. call oncreate, , onresume. second time click notification activity must running , instead of getting oncreate again, getting onnewintent.

to test this, add logs oncreate , onnewintent.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -