Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check App is installed on device android code

Tags:

java

android

I downloaded apk file from url(my server) and save it in sdcard. If user install it from sdcard, I want to know, whether is any notification that app is installed successfully or is app istalled in device. Is there any callback on installed app

like image 355
kumar_android Avatar asked Nov 26 '12 14:11

kumar_android


People also ask

How do I know if an application is installed in Android programmatically?

Call the method isPackageInstalled() : boolean isAppInstalled = isPackageInstalled("com. android. app" , this.

How do I see installed apps on Android?

Go to Settings and find the App Management or Apps section, depending on your phone. If you can't locate it, simply perform a quick search within Settings. Once in App Management, tap on See All Apps or App Settings to see the list of apps installed on your device, excluding the system apps.

Which app is installed in my device?

You can see all the apps you've ever downloaded on your Android phone by opening the "My apps & games" section in your Google Play Store. The apps you've downloaded are divided into two sections: "Installed" (all the apps currently installed on your phone) and "Library" (all the apps that aren't currently installed).


1 Answers

try this code :

protected boolean isAppInstalled(String packageName) {
        Intent mIntent = getPackageManager().getLaunchIntentForPackage(packageName);
        if (mIntent != null) {
            return true;
        }
        else {
            return false;
        }
    }

to get the package name of the app easily : just search your app in the google play website , and then you will take the id parameter ( it is the package name of the app) . Example : you will search on Youtube app on google play , and you will find it in this url :

https://play.google.com/store/apps/details?id=com.google.android.youtube&feature=search_result#?t=W251bGwsMSwxLDEsImNvbS5nb29nbGUuYW5kcm9pZC55b3V0dWJlIl0.

the package name is the id param, so it is : com.google.android.youtube

And then when you want to test , you will just have :

String packageName = "com.google.android.youtube";
boolean isYoutubeInstalled = isAppInstalled(packageName);

PLUS : if you want to get the list of all installed apps in you device , you can find your answer in this tutorial

like image 110
Houcine Avatar answered Sep 21 '22 23:09

Houcine