1. 2015 is going to be a great year for Android! Why wait??
    Samsung Galaxy Note 5 | Samsung Galaxy S6 | HTC One M9
  2. New Forum Created: Samsung Gear VR!

Check phone for installed app?


  1. pizzato16

    pizzato16 New Member

    Im putting together an app that has a function requiring an outside app to be downloaded ( if the user doesnt already have it) my question is, how would I code the activity to search the users phone for the installed app before auto downloading it? I dont want them to have to repeatedly download the app if its already on their phone. Thanks.

    Advertisement
    :
  2. alostpacket

    alostpacket Over Macho Grande? VIP Member

    Should be able to use this to see what is installed and compare the package name against what you're looking for
    Code:
    PackageManager pm = getPackageManager();                
    List<ApplicationInfo> list = pm.getInstalledApplications(0);
                    
    for (int i=0; i< list.size(); i++) 
    {
        ApplicationInfo appInfo = list.get(i);
        String packageName = appInfo.packageName;
        String appLabel = (String) pm.getApplicationLabel(appInfo);
        Drawable icon = pm.getApplicationIcon(appInfo);
    }
    
Loading...

Share This Page