qq版本太多。。。
遇到6.0手机监测失败
解决方法:
if(checkQQ(context) || isQQClientAvailable(context) || mTencent.isQQInstalled(context)){
//qq有安装
}
//Scheme 检测QQ分享
public static boolean checkQQ(Context context) {
if (context == null || context.getPackageManager() == null) return false;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mqqapi://share"));
return !context.getPackageManager().queryIntentActivities(intent, 0).isEmpty();
}
/**
* 判断qq是否可用
*
* @param context
* @return
*/
public static boolean isQQClientAvailable(Context context) {
final PackageManager packageManager = context.getPackageManager();
List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);
if (pinfo != null) {
for (int i = 0; i < pinfo.size(); i++) {
String pn = pinfo.get(i).packageName;
if (pn.equals("com.tencent.mobileqq")) {
return true;
}
}
}
return false;
}