java - Destroy foreground notification when the service get killed -


i have foreground service download contents form web.

unfortunately, due bug reported here service being killed when receiver received broadcast within service it's notification won't killed , saw following log in logcat:

i/activitymanager(449): killing 11073:my-package-name/u0a102 (adj 0): remove task 

is there anyway to destroy foreground notification when it's parent service killed os?

use stopforeground:

@override public void ondestroy() {  // bug seems exists android 4.4  if (android.os.build.version.sdk_int == android.os.build.version_codes.kitkat)  {     stopforeground(true);  }   super.ondestroy(); } 

or

public void ontaskremoved (intent rootintent) {  // bug seems exists android 4.4  if (android.os.build.version.sdk_int == android.os.build.version_codes.kitkat)  {    stopforeground(true);  } } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -