安卓安装源 [英] Android install source
问题描述
是否可以从 Android
应用获取安装源?
Is it possible to get the source of install from an Android
app?
我的意思是,我想看看应用是从 Play 商店
、Amazon Appstore
还是通过执行 APK 安装的.
I mean, I want to see, if the app is installed from the Play Store
, Amazon Appstore
or via executing an APK.
PS:我想在我的应用程序崩溃并且我能够发送错误报告时看到它,我的应用程序是通过 Play 商店
安装的.我如何获得这个值?
PS: I think to see it while my app crashes and I was able to send an bug report, that my app was installed via Play Store
. How do I get this value?
推荐答案
PackageManager 类提供了 getInstallerPackageName 方法将告诉您安装了您指定的包的任何包的名称.旁加载的应用程序不包含值.
The PackageManager class supplies the getInstallerPackageName method that will tell you the package name of whatever installed the package you specify. Side-loaded apps will not contain a value.
亚马逊商店的最新版本最终将 PackageManager.getInstallerPackageName() 设置为com.amazon.venezia
"以及与 Google Play 的com.android.vending
"对比代码>".
The latest version of the Amazon store finally sets PackageManager.getInstallerPackageName() to "com.amazon.venezia
" as well to contrast with Google Play's "com.android.vending
".
来源:如何要知道应用程序是从 google play 安装还是侧载安装? 例如:getInstallerPackageName 返回 null
这篇关于安卓安装源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!