android - Click on Notification then finish TimerTask? -


i creating notification in activity(for example text.class) , when active , click on it , return me in page(text.class) in page have timertask , need when click on notification reset page or finish() timertask .

how can ?

i thought when click on notification reset page , finish timertask.

this notification :

notificationmanager nman; nman=(notificationmanager) getsystemservice(notification_service); long when=system.currenttimemillis(); notification n; n=new notification(r.drawable.chat_logo,"",when); context context=getapplicationcontext(); string title=g.context.getresources().getstring(r.string.statusm); string text=g.context.getresources().getstring(r.string.statusms); intent notifintent=new intent(context,conversationpage.class); pendingintent pending; pending=pendingintent.getactivity(context,0,notifintent,android.content.intent.flag_activity_new_task); n.setlatesteventinfo(context, title, text, pending); n.flags = notification.flag_auto_cancel; nman.notify(0,n); 

add flag_activity_single_top flag notifintent deliver intent running activity key indicate intent notification? if yes cancel running timertask in onnewintent :

@override public void onnewintent(intent intent){     bundle extras = intent.getextras();     if(extras != null)         if(extras.containskey("isfromnotification"))         {            //cancel timertask here         }     } 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -