App Exit method Record:
1.exit
System.exit (0);
If the parameter is 0, the exit is normal, and a non-0 is the exception ending program.
If you use the first activity, close the app, or return to the first activity effect.
This method only shuts down the activity and does not shut down the service.
2.Pid
int pid = Android.os.Process.myPid ();//Get PIDandroid.os.Process.killProcess (PID) of current application;//Kill current Process
When this method exits the application, some post-processes are retained, for example: Service,notifications.
3.PackageName
Get Application Manager Activitymanager Manager = (Activitymanager) context.getsystemservice (context.activity_serv ICE);//force the end of the current application manager.killbackgroundprocesses (Context.getpackagename ());
exiting the app this way ends all activity in the application, because this method kills all processes, including activity,service,notifications, based on the application's package name.
This article is from the "Remember" blog, be sure to keep this source http://ziruo.blog.51cto.com/10107518/1838625
Android Program Exit method