Android Context Check isSystemApplication(Context context, String packageName)

Here you can find the source of isSystemApplication(Context context, String packageName)

Description

is System Application

Declaration

public static boolean isSystemApplication(Context context,
        String packageName) 

Method Source Code

//package com.java2s;

import android.content.Context;

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

public class Main {

    public static boolean isSystemApplication(Context context,
            String packageName) {
        PackageManager manager = context.getPackageManager();
        try {/*from w  ww .  ja va2s  . c  o m*/
            PackageInfo packageInfo = manager.getPackageInfo(packageName,
                    PackageManager.GET_CONFIGURATIONS);
            if (packageInfo != null
                    && (packageInfo.applicationInfo.flags & android.content.pm.ApplicationInfo.FLAG_SYSTEM) != 0) {
                return true;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
}

Related

  1. isOnline(Context context)
  2. isPermissionGranted(Context ctx)
  3. isSensAppInstalled(Context context)
  4. isServiceRunning(Context ctx, String className)
  5. isServiceRunning(Context ctx, String className)
  6. isTablet(Context ctx)
  7. isTablet(final Context context)
  8. isThemeInstalled(Context c, String theme)
  9. isUpdateAvailable(Context paramContext, String paramString)