My android application allows to launch other installed applications from this.This shows some allowed apps. If the user try to launch a disallowed application then show a m
Is it possible to get close/exit event of an application?
Yes it is possible inside your LauncherActivity
You can override
onDestroy
this method will be called on application exit.
How can i finish an application as whole(By finishing all its applications)?
I believe you want to stop your all running activities here. This can be achieved in multiple ways.
android.os.Process.killProcess(android.os.Process.myPid());
or
Intent intent = new Intent(getApplicationContext(), YourHomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
This will clear all the activities and will brings the user to the HomeActivity
. While calling this you can add a flag in intent and using that value you can finish the HomeActivity
also. Use finish()
method to finish the activity.
How to launch an application without having any history of previous launch?
You can use the same above Solution to achieve this. The second one.
Hope this will help.
There is an onTerminate
method in application class, but this cannot be used in production environment. See more about this here