PackageManager.getInstallerPackageName() 可以告诉我我的应用程序是从亚马逊应用商店安装的吗? [英] Can PackageManager.getInstallerPackageName() tell me that my app was installed from Amazon app store?

查看:44
本文介绍了PackageManager.getInstallerPackageName() 可以告诉我我的应用程序是从亚马逊应用商店安装的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划在亚马逊应用商店和 Google Play 上发布我的应用,并且我的应用中有一些东西需要根据应用是否从亚马逊应用商店安装而略有不同.如果我正确理解了 PackageManager.getInstallerPackageName(String packageName) 方法,它会告诉我安装我的应用程序的应用程序的名称.对?如果是这样,如果我的应用从亚马逊应用商店安装的,那么有人知道此方法返回的值是多少吗?如果不是,有谁知道我可以使用其他任何方法来确定我的应用是否是从亚马逊应用商店安装的?

I plan on publishing my app on Amazon app store as well as Google Play, and have some things in my app that need to behave slightly different depending on whether the app was installed from Amazon app store or not. If I understood the PackageManager.getInstallerPackageName(String packageName) method correctly, it tells me the name of the application that installed my app. Right? If so, does anyone know what the value returned by this method would be if my app was installed from Amazon app store? If not, does anyone know any other methods I can use to determine whether my app was installed from the Amazon app store?

注意:我知道关于 Stack Overflow 的其他问题已经得到回答,暗示使用PackageManager.getInstallerPackageName(String packageName) 到确定安装我的应用程序的应用程序的名称.然而,搜索 Stack Overflow 和其他地方,我一直无法确定返回的 valuePackageManager.getInstallerPackageName(String packageName) 将在如果应用是从亚马逊应用商店安装的.

Note: I am aware of other questions on Stack Overflow which have been answered alluding to the usage of PackageManager.getInstallerPackageName(String packageName) to determine the name of the application that installed my app. However, searching Stack Overflow and elsewhere, I have not been able to determine what the value returned by PackageManager.getInstallerPackageName(String packageName) would be in case the app was installed from the Amazon app store.

推荐答案

Calling PackageManager.getInstallerPackageName(myPackageName),其中 myPackageName 是包的名称(您希望为其确定安装程序的应用)提供以下值:

Calling PackageManager.getInstallerPackageName(myPackageName), where myPackageName is the name of the package (of the app for which you wish to determine the installer) gives the following values:

  • null 如果应用是从亚马逊应用商店安装的
  • null 如果应用直接安装在任何应用商店之外.
  • com.android.vending 如果应用是从 Google Play 安装的.
  • null if the app was installed from Amazon app store
  • null if the app was installed directly outside of any app store.
  • com.android.vending if the app was installed from Google Play.

(感谢@CommonsWare 提供指针.)

(Thanks @CommonsWare for the pointer.)

这篇关于PackageManager.getInstallerPackageName() 可以告诉我我的应用程序是从亚马逊应用商店安装的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆