How to force stop an app with adb in Android

You can terminate and stop a running package using the adb command

1. What is the difference between "stop" and "force-stop"?

The difference between stop and force-stop is that stop simply means that an Activity or Service is terminated, but force stop means that the process is killed and the Package's stop state is changed to true.

When the Package's stop state is true, the app cannot receive broadcasts until the app is started explicitly once. When the app is launched, the stop state is changed to false so that it can receive broadcasts.

2. How to force stop a package

In this example, it force stop com.google.android.youtube.

$ adb shell am force-stop com.google.android.youtube

Syntax:

$ adb shell am force-stop [--user <USER_ID> | all | current] <PACKAGE>

3. How to force stop a package running in a specific user

In this example, it force stop com.google.android.youtube unning in the user 10.

$ adb shell am force-stop --user 10 com.google.android.youtube

Related Posts

codechachaCopyright ©2019 codechacha