How to force system shutdown and application shutdown on Android

I want to forcibly close my application as an Android system. For example, select the system steps below

"Setting" -> "Apps" -> "my app name" -> "Force stop"  

I want to achieve the same behavior through code. What should I do?

resolvent:

You can write the following code line to kill your app process. This is what the code runs when you click force stop

android.os.Process.killProcess(android.os.Process.myPid());

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>