How to detect if Google Play is installed? (Not Market)

前端 未结 5 1239
[愿得一人]
[愿得一人] 2021-01-02 20:43

Whether the app installed is called Google Play or Market, the package name is the same com.android.vending.

I need to be able to detect whether the app

5条回答
  •  清歌不尽
    2021-01-02 20:50

    In my App I check possibility to open play store before fire it like:

        public static boolean isResolveActivity(Intent intent) {
                return App.getInstance().getPackageManager().resolveActivity(intent, PackageManager.GET_RESOLVED_FILTER) != null;
            }
    
       public void isResolveActivity(String appPackage) {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackage));
    
          if(isResolveActivity(intent)){
          ...open intent
          }
      }
    

提交回复
热议问题