List of usage examples for android.content.pm PackageManager GET_UNINSTALLED_PACKAGES
int GET_UNINSTALLED_PACKAGES
To view the source code for android.content.pm PackageManager GET_UNINSTALLED_PACKAGES.
Click Source Link
From source file:Main.java
public static List<ApplicationInfo> getInstalledApplications(PackageManager pm) { int retrieveFlags = PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS; List<ApplicationInfo> packages = pm.getInstalledApplications(retrieveFlags); return packages; }
From source file:Main.java
public static boolean checkPackage(Context context, String p) { try {//from w w w. jav a 2 s . co m context.getPackageManager().getApplicationInfo(p, PackageManager.GET_UNINSTALLED_PACKAGES); return true; } catch (PackageManager.NameNotFoundException e) { return false; } }
From source file:Main.java
public static boolean isSystemApp(Context context, String packageName) { String ppt_install_path = ""; try {// w ww .j av a2s.c om ppt_install_path = context.getPackageManager().getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES).sourceDir; } catch (Exception e) { e.printStackTrace(); } // LogTag.e("isSystemApp", ppt_install_path); if (ppt_install_path.startsWith("/system/")) { return true; } return false; }
From source file:Main.java
public static boolean isInstallApp(Context context, String packageName) { PackageManager packageManager = context.getPackageManager(); try {/*w w w.j av a 2 s.c o m*/ packageManager.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES); return true; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); return false; } }
From source file:Main.java
public static boolean isApkInstalled(Context context, String packageName) { PackageManager pkgManager = context.getPackageManager(); List<PackageInfo> pkgs = pkgManager.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES); for (PackageInfo pkg : pkgs) { if (packageName.equals(pkg.packageName)) { return true; }// ww w . j a v a 2 s.c o m } return false; }
From source file:Main.java
public static boolean isNewApkInstalled(Context context, String packageName, int version) { PackageManager pkgManager = context.getPackageManager(); List<PackageInfo> pkgs = pkgManager.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES); for (PackageInfo pkg : pkgs) { if (packageName.equals(pkg.packageName) && pkg.versionCode == version) { return true; }//from w ww.j av a2 s. com } return false; }
From source file:Main.java
public static boolean isAppOk(Context context, String packName) { boolean appIsOk = false; try {/* w w w .j av a 2 s .c o m*/ ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(packName, PackageManager.GET_UNINSTALLED_PACKAGES); if (applicationInfo != null) { appIsOk = true; } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return appIsOk; }
From source file:Main.java
public static boolean isAppOk(Context context, String packName) { boolean appIsOk = false; try {/*from w w w . j av a2 s .com*/ ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(packName, PackageManager.GET_UNINSTALLED_PACKAGES); if (applicationInfo != null) { appIsOk = true; } } catch (Exception e) { // TODO: handle exception } return appIsOk; }
From source file:Main.java
public static boolean isApkInstalled(Context context, String packageName) { try {/*from w w w . j a va 2 s. c o m*/ ApplicationInfo info = context.getPackageManager().getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES); return info != null; } catch (NameNotFoundException e) { return false; } }
From source file:Main.java
public static boolean checkApkExist(Context context, String packageName) { if (packageName == null || "".equals(packageName)) { return false; }/*ww w. j a v a 2 s .co m*/ try { context.getPackageManager().getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES); return true; } catch (NameNotFoundException e) { return false; } }