Tuesday, 15 March 2011

android - Calling OnResume upon Getting Activity -



android - Calling OnResume upon Getting Activity -

i'm trying have notification builder phone call onresume() upon intent beingness fired, similar when user chooses app background running apps. i've tried numerous flags, not getting result desire.

notificationcompat.builder mbuilder = new notificationcompat.builder(this); intent intent = new intent(this, mainactivity.class); intent.setaction("open_tab_contacts"); intent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top); pendingintent pintent = pendingintent.getactivity(this, 0, intent, 0); mbuilder.setsmallicon(r.drawable.antartica7); mbuilder.setcontenttitle("notification alert, click me!"); mbuilder.setcontenttext("hi, android notification detail,wewww!"); mbuilder.setcontentintent(pintent); mbuilder.setautocancel(true); notificationmanager mnotificationmanager = (notificationmanager) getsystemservice(context.notification_service); // notificationid allows update notification later on. mnotificationmanager.notify("newmessage", 1, mbuilder.build());

i have tried adding

android:launchmode="singleinstance"

and

android:launchmode="singletask"

to androidmanifest well.

since no flags working, instead check intent action manually.

added oncreate():

if(getintent().getaction() != null) { if(getintent().getaction().equals("open_tab_contacts")) { system.out.println("pending intent called"); } else { //normal oncreate } }

android

No comments:

Post a Comment