java - Resuming current background activity on notification -
my application contains multiple activities. have implemented push notifications , shown notification in bar. issue is, when click on notification take me specific activity has specified.
intent intent =new intent(gcmservice.this, mainactivity.class); pendingintent pendingintent = pendingintent.getactivity(gcmservice.this, 0, intent, 0); notificationcompat.builder notificationbuilder = new notificationcompat.builder( getapplicationcontext()) .setcontenttitle(getresources().getstring(r.string.app_name)) .setautocancel(true) .setcontentintent(pendingintent); notificationbuilder.setcontentintent(pendingintent); mnotificationmanager.notify((int) when, notificationbuilder.build());
i want if activity in background, , user click on notification app resume current activity in background , show dialog box. , if application closed. open launching activity , show dialog box.
if want continue again when click notification(in case application still running on background) can using method : http://developer.android.com/training/basics/activity-lifecycle/stopping.html
i've tried , works.
Comments
Post a Comment