java - I am using service for notification. How to kill previous thread? -


whenever removing app background, 1 background thread running , if again opening app getting 2 notification.

there method it's called stopservice(intent intent). inside service, can call stopself()

if call stopservice(), method ondestroy() in service called (not stopservice() method):

 @override     public void ondestroy() {       timer.cancel();       task.cancel();           log.i(tag, "oncreate() , service stopped...");     } 

you must implement ondestroy().


Comments

Popular posts from this blog

html - How to custom Bootstrap grid height? -

javascript - pass values from mssql to views in node -

javascript - Understanding ExtJS Framework Syntax -