Can PackageManager.getInstallerPackageName() tell me that my app was installed from Amazon app store?(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)
到确定安装我的应用程序的应用程序的名称.然而,搜索堆栈溢出和其他地方,我一直无法确定返回的值是什么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 安装的.
null
if the app was installed from Amazon app storenull
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() 可以告诉我我的应用是从亚马逊应用商店安装的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PackageManager.getInstallerPackageName() 可以告诉我我的应用是从亚马逊应用商店安装的吗?
基础教程推荐
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01