Sathish Sathish Sathish Sathish - 4 months ago 66x
Android Question

How to check programmatically if an application is installed or not in Android?

We have installed applications programmatically.

  1. If the application is already installed in the device the application is open automatically.

  2. Otherwise install the particular application.

Guide Me. I have no idea.


Try with this:

public class Example extends Activity {
    protected void onCreate(Bundle savedInstanceState) {
        //Put the package name here...
        boolean installed = appInstalledOrNot("com.Ch.Example.pack");  
        if(installed) {
            //This intent will help you to launch if the package is already installed
            Intent LaunchIntent = getPackageManager()

            System.out.println("App is already installed on your phone");         
        } else {
            System.out.println("App is not currently installed on your phone");

    private boolean appInstalledOrNot(String uri) {
        PackageManager pm = getPackageManager();
        boolean app_installed;
        try {
            pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
            app_installed = true;
        catch (PackageManager.NameNotFoundException e) {
            app_installed = false;
        return app_installed;