I have an application A with an activity that launches another application B as follow:
@Override
protected void onResume() {
super.onResume();
if (launched == false) {
Intent intent = getPackageManager().getLaunchIntentForPackage(apk);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
launched = true;
} else {
// Here I launch another activity of application A
launched = false;
}
}
This other application B have a close button to finish its main activity.
The logic behavior is to return on the first application A in the onResume()
's "else".
Sometimes the onDestroy()
method is called from my "launch" activity of the application A and the Android Desktop appears when application B stops.
My first thought is about the Android memory management. If the application B takes to much memory or if the Android GC turns itself on at this moment, the application A can be killed (Application A takes a lot of memory but it is another problem).
In the manifest, I put android:persistent="true"
but it doesn't change anything.
Do you have any idea of how can I be sure to go back to application A when application B is over ?
EDIT:
When application B finish, the application A activity where I launched the application B doesn't go to onResume()
but directly to onStop()
. I thought it was like onStart -> onResume (here I launch application B) -> onPause (application B is now visible) -> onResume (it is the second time in onResume so the application B is over).
Thanks