I'm here developed a hybrid cordova based android app in which i need to do some task before killing app for this i wrote below code onDestroy() in MainActivity and onTaskRemoved in one of service class which is calling perfectly on Samsum, Motorola, Asus etc. many device except Redmi MI Devices.
Some days back the same code was working in MI device but now its not after updating MI with MIUI 9.6.0 and above. I have tested one of MI device with MI 9.5.0 in which its working both the method but after upgrade of my device now its not working.
So is someone having the same issue? what we can do to achieve app killing event? is there any option through which it should start working or having any other way to do the same only for MI device?
I have checked over the internet and did changes for Autostart options as well still not working.
@Override
public void onTaskRemoved(Intent rootIntent) {
Log.d(getClass().getName(), "App just got removed from Recents!");
Toast.makeText(getApplicationContext(),"18. onTaskRemoved()", Toast.LENGTH_SHORT).show();
}
@Override
public void onDestroy() {
super.onDestroy();
Toast.makeText(getApplicationContext(),"16. onDestroy()", Toast.LENGTH_SHORT).show();
}