I have adb
running and device is connected to my system in debugging mode,
I want to uninstall app using intent launch using adb shell am start <INTENT>
I don't want to uninstall using adb uninstall com.company.apppackage
and I don't want to do it even by using adb shell pm uninstall com.company.apppackage
How can I send an intent with android.intent.action.DELETE
action for a specific package allowing the user to see the prompt and uninstall the program?
Use this command in cmd:
For example:
The
-k
flag tells the package manager to keep the cache and data directories around, even though the app is removed. If you want a clean uninstall, don't specify-k
.Using ADB, you can use any of the following three commands:
Replace PACKAGE with package name of the installed user app. The app mustn't be a device administrator for the command to work successfully. All of those commands would require user's confirmation for removal of app.
Details of the said command can be known by checking am's usage using
adb shell am
.I got the info about those commands using Elixir 2 (use any equivalent app). I used it to show the activities of Package Installer app (the GUI that you see during installation and removal of apps) as well as the related intents. There you go.
The alternative way I used was: I attempted to uninstall the app using GUI until I was shown the final confirmation. I didn't confirm but execute the command
Among other things, it showed me useful details of the intent passed in the background. Example:
Here, you can see the action, data, flag and component - enough for the goal.
In my case, I do an
adb shell pm list packages
to see first what are the packages/apps installed in my Android device or emulator, then upon locating the desired package/app, I do anadb shell pm uninstall -k com.package.name
.I assume that you enable
developer mode
on your android device and you are connected to your device and you have shell access (adb shell
).Once this is done you can uninstall application with this command
pm uninstall --user 0 <package.name>
. 0 is root id -this way you don't need too root your device.Here is an example how I did on my Huawei P110 lite
You can do it from adb using this command:
While the above answers work but in case you have multiple devices connected to your computer then the following command can be used to remove the app from one of them:
If you want to find out the device serial then use the following command:
This will give you a list of devices attached. The left column shows the device serials.