问题描述
我计划在亚马逊应用商店和 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) 到确定安装我的应用程序的应用程序的名称.然而,搜索堆栈溢出和其他地方,我一直无法确定返回的值是什么PackageManager.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 byPackageManager.getInstallerPackageName(String packageName)would be in case the app was installed from the Amazon app store.
推荐答案
调用 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 安装的.
nullif the app was installed from Amazon app storenullif the app was installed directly outside of any app store.com.android.vendingif the app was installed from Google Play.
(感谢@CommonsWare 的指点.)
(Thanks @CommonsWare for the pointer.)
这篇关于PackageManager.getInstallerPackageName() 可以告诉我我的应用是从亚马逊应用商店安装的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)