• <small id='hBmsk'></small><noframes id='hBmsk'>

      1. <i id='hBmsk'><tr id='hBmsk'><dt id='hBmsk'><q id='hBmsk'><span id='hBmsk'><b id='hBmsk'><form id='hBmsk'><ins id='hBmsk'></ins><ul id='hBmsk'></ul><sub id='hBmsk'></sub></form><legend id='hBmsk'></legend><bdo id='hBmsk'><pre id='hBmsk'><center id='hBmsk'></center></pre></bdo></b><th id='hBmsk'></th></span></q></dt></tr></i><div id='hBmsk'><tfoot id='hBmsk'></tfoot><dl id='hBmsk'><fieldset id='hBmsk'></fieldset></dl></div>
        <legend id='hBmsk'><style id='hBmsk'><dir id='hBmsk'><q id='hBmsk'></q></dir></style></legend>
          <bdo id='hBmsk'></bdo><ul id='hBmsk'></ul>
      2. <tfoot id='hBmsk'></tfoot>

        无法确定 Android 设备上是否安装了 Google Play 商店

        Cannot determine whether Google play store is installed or not on Android device(无法确定 Android 设备上是否安装了 Google Play 商店)
          <tbody id='YSbtx'></tbody>

          <small id='YSbtx'></small><noframes id='YSbtx'>

          <i id='YSbtx'><tr id='YSbtx'><dt id='YSbtx'><q id='YSbtx'><span id='YSbtx'><b id='YSbtx'><form id='YSbtx'><ins id='YSbtx'></ins><ul id='YSbtx'></ul><sub id='YSbtx'></sub></form><legend id='YSbtx'></legend><bdo id='YSbtx'><pre id='YSbtx'><center id='YSbtx'></center></pre></bdo></b><th id='YSbtx'></th></span></q></dt></tr></i><div id='YSbtx'><tfoot id='YSbtx'></tfoot><dl id='YSbtx'><fieldset id='YSbtx'></fieldset></dl></div>
          • <bdo id='YSbtx'></bdo><ul id='YSbtx'></ul>
            • <legend id='YSbtx'><style id='YSbtx'><dir id='YSbtx'><q id='YSbtx'></q></dir></style></legend>
              <tfoot id='YSbtx'></tfoot>

                1. 本文介绍了无法确定 Android 设备上是否安装了 Google Play 商店的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这是检查设备上已安装软件包的简单问题...在我将操作系统升级到 2.3.5 之前,我可以使用以下代码找到 Market/Play 商店:

                  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:

                  private static final String GooglePlayStorePackageName = "com.google.market";
                  
                  void someMethod() {
                      packageManager = getApplication().getPackageManager();
                      List<PackageInfo> packages = packageManager.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES);
                      for (PackageInfo packageInfo : packages) {
                          if (packageInfo.packageName.equals(GooglePlayStorePackageName)) {
                              googlePlayStoreInstalled = true;
                              break;
                          }
                      }
                  }
                  

                  更新后由于某种原因,我根本找不到表明应用程序已安装的to包名称,虽然它在设备上,我可以访问市场.

                  For some reason after the update, I simply cannot find the to package name to indicate the application is installed, although it is on the device, and I can access the market.

                  包名有变化吗?还是我看错了?

                  Has the package name changed? or perhaps I'm looking at this the wrong way?

                  谢谢,

                  亚当.

                  更新:

                  这是一种检查是否安装了软件包的愚蠢方法……更好的方法是:

                  That was a stupid way to check if a package is installed... a better way is:

                  protected final boolean isPackageInstalled(String packageName) {
                      try {
                          application.getPackageManager().getPackageInfo(packageName, 0);
                      } catch (NameNotFoundException e) {
                          return false;
                      }
                      return true;
                  }
                  

                  推荐答案

                  请注意,这近 5 年的旧代码并不是最优的,Google 不喜欢无缘无故检查所有已安装的软件包.请同时查看其他答案.

                  包名已更改,现在是 com.android.vending

                  The package name has changed, it is now com.android.vending

                  试试:

                  private static final String GooglePlayStorePackageNameOld = "com.google.market";
                  private static final String GooglePlayStorePackageNameNew = "com.android.vending";
                  
                  void someMethod() {
                      PackageManager packageManager = getApplication().getPackageManager();
                      List<PackageInfo> packages = packageManager.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES);
                      for (PackageInfo packageInfo : packages) {
                          if (packageInfo.packageName.equals(GooglePlayStorePackageNameOld) ||
                              packageInfo.packageName.equals(GooglePlayStorePackageNameNew)) {
                              googlePlayStoreInstalled = true;
                              break;
                          }
                      }
                  }
                  

                  这篇关于无法确定 Android 设备上是否安装了 Google Play 商店的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Android - Is it possible to get install referrer programmatically(Android - 是否有可能以编程方式安装引荐来源网址)
                  How to sign an APK with more than one certificate?(如何使用多个证书签署 APK?)
                  versionCode vs versionName in Android Manifest(Android Manifest 中的 versionCode 与 versionName)
                  What does this Google Play APK publish error message mean?(这个 Google Play APK 发布错误消息是什么意思?)
                  Lost my keystore for uploaded app on android market(丢失了我在 android 市场上上传的应用程序的密钥库)
                  App on Google Play always shows quot;Updatequot; instead of open(Google Play 上的应用程序总是显示“更新;而不是打开)
                        <tbody id='FbrEp'></tbody>

                      <small id='FbrEp'></small><noframes id='FbrEp'>

                      <tfoot id='FbrEp'></tfoot><legend id='FbrEp'><style id='FbrEp'><dir id='FbrEp'><q id='FbrEp'></q></dir></style></legend>
                            <bdo id='FbrEp'></bdo><ul id='FbrEp'></ul>
                            <i id='FbrEp'><tr id='FbrEp'><dt id='FbrEp'><q id='FbrEp'><span id='FbrEp'><b id='FbrEp'><form id='FbrEp'><ins id='FbrEp'></ins><ul id='FbrEp'></ul><sub id='FbrEp'></sub></form><legend id='FbrEp'></legend><bdo id='FbrEp'><pre id='FbrEp'><center id='FbrEp'></center></pre></bdo></b><th id='FbrEp'></th></span></q></dt></tr></i><div id='FbrEp'><tfoot id='FbrEp'></tfoot><dl id='FbrEp'><fieldset id='FbrEp'></fieldset></dl></div>