获得所有package,根据包名查找

解决方案 »

  1.   


    context.getPackageManager().getPackageInfo(包名, PackageManager.GET_ACTIVITIES);例如豌豆荚的是com.wandoujia.phoenix2
    应用宝的是com.tencent.android.qqdownloader
    上面的包名是获取应用所对应的包名得到的,其他的市场也可以这么做
      

  2.   

    代码是判断是否有这个包名的,为空则是没有获取手机应用包名:http://blog.csdn.net/feng88724/article/details/6198446
      

  3.   

    直接用intent.CATEGORY_APP_MARKET去查询吧,按照包名太麻烦
      

  4.   


    public static boolean hasAnyMarketInstalled(Context context) {
        Intent intent = new Intent();
        intent.setData(Uri.parse("et://details?id=android.browser"));
        List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
        return 0 != list.size();
    }这段代码可以解决问题。