PackageManager.getInstallerPackageName() 可以告诉我我的应用是从亚马逊应用商店安

2023-11-09移动开发问题
0

本文介绍了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 by PackageManager.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 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() 可以告诉我我的应用是从亚马逊应用商店安装的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

从 Documents 目录存储和读取文件 iOS 5
Storing and reading files from Documents directory iOS 5(从 Documents 目录存储和读取文件 iOS 5)...
2024-08-12 移动开发问题
9

收到消息“警告:在正常情况下,_fillInQueueWithExtraSpace:.."和 MPMovieP
Got the message quot;WARNING: under normal conditions, _fillInQueueWithExtraSpace:..quot; and MPMoviePlayer rotation not work in iPad IOS 5.1(收到消息“警告:在正常情况下,_fillInQueueWithExtraSpace:..和 MPMoviePlayer 旋转在 iPad IOS 5.1 中...
2024-08-12 移动开发问题
6

RPG 游戏循环和类结构(cocos2D for iPhone)
RPG Game loop and class structure (cocos2D for iPhone)(RPG 游戏循环和类结构(cocos2D for iPhone))...
2024-08-12 移动开发问题
6

如何抓取 b2Body 并在屏幕上移动它?(cocos2d,box2d,iphone)
How to grab a b2Body and move it around the screen? (cocos2d,box2d,iphone)(如何抓取 b2Body 并在屏幕上移动它?(cocos2d,box2d,iphone))...
2024-08-12 移动开发问题
12

沙盒游戏中心回合事件通知不一致
Sandbox Game Center Turn Event Notifications Not Consistent(沙盒游戏中心回合事件通知不一致)...
2024-08-12 移动开发问题
4

Cocos2D求助:如何连续旋转一个精灵并在旋转的精灵中生成子精灵
Cocos2D help: How to rotate a sprite continuously and generate child sprites in the rotating sprite(Cocos2D求助:如何连续旋转一个精灵并在旋转的精灵中生成子精灵)...
2024-08-12 移动开发问题
4