I have googled this non stop today and could not find anything. My scenario is the following:
I have an Android app that auto replies to incoming messages. I have
The method that I used to kill the processes when I swipe apps from the recents is: in the first activity of the app, in the method OnDestroy I write that "the process have to kill". In this way I call the OnDestroy method of the process and so the process really kills himself and the notification is removed. Specifically, in the first Activity:
@Override
public void onDestroy() {
super.onDestroy();
Intent intent = new Intent();
intent.setAction(Service.MY_ACTION_FROMACTIVITY);
intent.putExtra(Service.CMD, Service.CMD_STOP);
sendBroadcast(intent);
}
So the following operations are:
@Override
public void onDestroy() {
// TODO Auto-generated method stub
barNotification.cancel(NOTIFICATION);
sensorManager.unregisterListener(this);
this.unregisterReceiver(myServiceReceiver);
super.onDestroy();
}
I hope that I can help you.