0

Is there a way to check if some app is installed on your phone based on a package name? For example is com.google.maps installed on your phone. User would enter package name, click button Scan for the app or similar inside the app, and if the app is installed it would say that app is installed.

1 Answers1

3

whatever test this code from detect-an-application-is-installed-or-not:

    isAppInstalled("com.simexusa.campusmaps_full");

private boolean isAppInstalled(String packageName) {
    PackageManager pm = getPackageManager();
    boolean installed = false;
    try {
       pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
       installed = true;
    } catch (PackageManager.NameNotFoundException e) {
       installed = false;
    }
    return installed;
}
Community
  • 1
  • 1
javad
  • 833
  • 14
  • 37