I want to force close my app as Android system.
Such as select below step on system.
"Setting" -> "Apps" -> "my app name" -> "Force stop"
I want to implement the same behavior by code.
How can I do it?
You can write below line of code to kill your App process. This is what the code runs when you click the Force Stop in
Settings --> Manage Applications
android.os.Process.killProcess(android.os.Process.myPid());