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

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -