How to Prompt Android Package Uninstall Dialog Using ADB

How to Prompt Android Package Uninstall Dialog Using ADB

30 November 2024 Stephan Petzl Leave a comment Tech-Help

In the realm of Android development, managing applications via ADB (Android Debug Bridge) is a common task. One frequently asked question is how to prompt the uninstall dialog for a specific application package using ADB. This guide will explore various methods to achieve this, providing a comprehensive solution for developers.

Understanding the Problem

When developers want to uninstall an app from an Android device, they typically use the adb uninstall command. However, there are scenarios where one may prefer to trigger the uninstall dialog, allowing users to confirm the removal. This is particularly useful when testing user interactions or when the app is not a device administrator.

Solution: Using ADB Commands

To display the uninstall dialog for a specified package, you can use the following ADB command:

adb shell am start -a android.intent.action.DELETE -d package:

This command sends an intent to the system to delete the specified package, prompting the uninstall dialog. Ensure that you replace <your app package> with the actual package name of the app you wish to uninstall.

Alternative Commands

In addition to the above command, here are some alternative methods that may be useful:

  • adb shell am start -a android.intent.action.UNINSTALL_PACKAGE -d "package:PACKAGE"
  • adb shell am start -n com.android.packageinstaller/.UninstallerActivity -d "package:PACKAGE"

These commands also require user confirmation for app removal and can be useful in different contexts.

Practical Considerations

Before executing these commands, ensure that:

  • Developer mode is enabled on your Android device.
  • The device is connected to your system and recognized by ADB.
  • The app is not a device administrator, as this may prevent uninstallation.

Handling Multiple Devices

If multiple devices are connected, specify the target device using:

adb -s  shell am start -a android.intent.action.DELETE -d package:

Retrieve the device serial using adb devices.

Enhancing Your Testing Workflow with Repeato

Automating app testing can significantly streamline your development process. Our product, Repeato, offers a no-code test automation solution for iOS and Android. With its ability to execute ADB commands via script steps, you can efficiently manage app installations and uninstalls, ensuring a seamless testing experience.

For more information on how Repeato can enhance your testing capabilities, visit our documentation page.

By leveraging these ADB commands and utilizing tools like Repeato, developers can effectively manage app lifecycle events, ensuring a robust and user-friendly application experience.

Like this article? there’s more where that came from!