androidpackage-managersandroid-payandroid-package-managers

Android Pay - How to detect if Android Pay is installed?


There is this code (taken from https://stackoverflow.com/a/5016624/1369016):

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;
}

But I don't know what to put in the packageName. I tried com.google.android.gms.wallet (which is the package of some Wallet fragments used by Android Pay) but the above method returns false.


Solution

  • It turns out the package name required is "com.google.android.apps.walletnfcrel". With that you can call the method in the question to detect if Android Pay is installed.