[android] Android ADB stop application command like "force-stop" for non rooted device

I'm trying to stop application on Android 2.3.7 device. But in this version of Android I can't use "force-stop" command. Do you know any other ways to close application on non rooted device?

This question is related to android adb

The answer is


If you want to kill the Sticky Service,the following command NOT WORKING:

adb shell am force-stop <PACKAGE>
adb shell kill <PID>

The following command is WORKING:

adb shell pm disable <PACKAGE>

If you want to restart the app,you must run command below first:

adb shell pm enable <PACKAGE>

If you have a rooted device you can use kill command

Connect to your device with adb:

adb shell

Once the session is established, you have to escalade privileges:

su

Then

ps

will list running processes. Note down the PID of the process you want to terminate. Then get rid of it

kill PID

To kill from the application, you can do:

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