i'm trying to close notification when my app being closed,because when i close the app from (Recent Task / Swipe to exit),notification still appear and in case user try to click on notification the app will crash.
@Override
protected void onDestroy() {
super.onDestroy();
notification.cancel(1);
try {
MApplication.sBus.unregister(this);
} catch (Exception e) {
e.printStackTrace();
}
}
in onDestroy()
but doesn't work because onDestroy()
is not called everytime.