Android examples for Android OS:Shell
is Installed We Chat
//package com.java2s; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { public static boolean isInstalledWeChat(Context context) { return isPackageInstalled(context, "com.tencent.mm"); }//from w ww . j av a 2 s .co m private static boolean isPackageInstalled(Context context, String pkgName) { PackageManager pm = context.getPackageManager(); try { PackageInfo pkgInfo = pm.getPackageInfo(pkgName, 0); return pkgInfo != null && pkgInfo.applicationInfo.enabled; } catch (PackageManager.NameNotFoundException e) { } return false; } }