Android examples for App:Package
Checks if a package is installed.
//package com.java2s; import android.content.Context; public class Main { /** Checks if a package is installed. * /*w w w . j av a 2s. co m*/ * @param context Context to be used to verify the existence of the package. * @param packageName Package name to be searched. * @return true if the package is discovered; false otherwise */ public static boolean isPackageInstalled(Context context, String packageName) { try { context.getPackageManager().getApplicationInfo(packageName, 0); return true; } catch (Exception e) { return false; } } }