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
Post a Comment