Cannot determine whether Google play store is installed or not on Android device

后端 未结 5 1198
自闭症患者
自闭症患者 2020-12-08 21:27

This was a simple matter of checking the installed packages on the device... before I\'ve upgraded my OS to 2.3.5, I could locate the Market/Play store, using this code:

5条回答
  •  春和景丽
    2020-12-08 21:54

    As Michael stated in the comments Google Play Services is not the same as the Google Play Store. Use this to determine whether or not the Play Store is installed on your device:

    public static boolean isPlayStoreInstalled(Context context){
        try {
            context.getPackageManager()
                    .getPackageInfo(GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE, 0);
            return true;
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }
    }
    

提交回复
热议问题