Android Context Check hasOtherSPAppsInstalled(Context context)

Here you can find the source of hasOtherSPAppsInstalled(Context context)

Description

has Other SP Apps Installed

License

Open Source License

Declaration

private static boolean hasOtherSPAppsInstalled(Context context) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import android.content.*;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import android.util.Log;
import java.util.List;

public class Main {
    private static final String TAG = "SPAUtil";
    public static final String SPA_PACKAGE_PREFIX = "de.danoeh.antennapodsp";

    private static boolean hasOtherSPAppsInstalled(Context context) {
        PackageManager pm = context.getPackageManager();
        if (pm == null) {
            Log.e(TAG, "Unable to get package manager reference");
            return false;
        }//from  ww w.  j  ava  2s . co  m

        List<PackageInfo> packages = pm.getInstalledPackages(0);
        final String thisPackage = context.getPackageName();

        for (PackageInfo otherPackageInfo : packages) {
            String otherPackage = otherPackageInfo.packageName;
            if (!thisPackage.equals(otherPackage)
                    && otherPackage.startsWith(SPA_PACKAGE_PREFIX)) {
                Log.i(TAG, "Found another single purpose app: "
                        + otherPackage);
                return true;
            }
        }

        return false;
    }
}

Related

  1. hasAsymmericMasterSecret(Context context)
  2. hasConnection(Context c)
  3. hasInternetConnection(Context context)
  4. hasInternetConnectivity(Context applicationContext)
  5. hasNotificationPermission(Context context)
  6. hasTelephony(@Nonnull Context context)
  7. hasVibrationPermission(Context context)
  8. is3G(Context context)
  9. isAccessibilityEnabled(Context context, String id)