简体   繁体   English

从Google Play商店下载应用时,getInstallerPackageName()是否可能为null?

[英]Is it possible that getInstallerPackageName() is null when app downloaded from Google Play Store?

In my app I use some implementation to check, if the app was downloaded from Google Play Store. 在我的应用程序中,我使用一些实现检查该应用程序是否是从Google Play商店下载的。 Otherwise it does not start. 否则它将无法启动。 For this I use getInstallerPackageName() by checking if the name is com.android.vending. 为此,我通过检查名称是否为com.android.vending来使用getInstallerPackageName()

This basically works on all of my devices, but in Google Play the pre-launch report tells me, that 2 of 9 devices return null from this method. 这基本上可以在我的所有设备上使用,但是在Google Play中,发布前的报告告诉我,在9台设备中,有2台通过此方法返回null。 Now there are two possibilities. 现在有两种可能性。 Either this method returns sometimes null, even if it's downloaded from Google Play Store, or it is null, because the pre-launch report somehow causes it. 即使从Google Play商店下载了该方法,有时返回的还是null,或者返回null,因为预发布的报告是由某种原因导致的。 When it is null, this would usually mean that the apk was not downloaded from Google Play Store. 如果为null,则通常表示未从Google Play商店下载apk。 I have no idea how this pre-launch report works in the background. 我不知道这份发布前的报告在后台如何运作。 Maybe the APK is somehow processed in the background before it will be deployed on these "test devices". 也许在将APK部署到这些“测试设备”上之前,它已经在后台进行了某种方式的处理。 Does anybody have a clue if it is possible that this value is null, even if it is downloaded from Google Play Store? 即使从Google Play商店下载了该值,是否有人知道此值是否为空?

This sounds like an implementation detail bug with Google Play pre-launch report. 这听起来像是Google Play发布前报告中的实现细节错误。 Please could you contact Google Play support and let them know the problem. 请您联系Google Play支持人员,让他们知道问题所在。 Checking your install came from Google Play should be a reasonable thing to do. 检查您的安装来自Google Play,应该是一件合理的事情。 Even for installs that came via P2P sharing for users with expensive data, if you use Google Play P2P in ShareIt / Xender / Files Go the installer should still be Google Play. 即使对于通过P2P共享为数据量昂贵的用户进行的安装,如果您在ShareIt / Xender / Files Go中使用Google Play P2P,则安装程序仍应为Google Play。

The above advice is applicable to anyone - the following is for the original asker: 以上建议适用于任何人-以下适用于原始询问者:

I will contact the pre-launch report team and ask them about it (I work for Google). 我将与发布前的报告小组联系,并向他们询问(我为Google工作)。 Please could you contact Google Play support and let them know the problem. 请您联系Google Play支持人员,让他们知道问题所在。 If necessary tell them I asked you to, and ask them to route any bug to me (they should be able to find them by name). 如有必要,请告诉他们我要您这样做,并请他们将所有错误发送给我(他们应该可以按名称查找它们)。 I'd be really sad if you had to remove the check from your app. 如果您不得不从应用程序中删除支票,我会很难过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从Google Play下载应用程序时存储客户数据 - Store Customer data when app is downloaded from google play 从 Google Play 下载时应用程序崩溃 - App crashes when downloaded from Google Play 从Play商店下载的应用未加载Google Map - Google Map is not loaded for the app downloaded from the Play Store 使用 Android Studio Android 应用程序在设备上运行 Google plus 但从 Play 商店下载时不起作用 - Using Android Studio Android app Working Google plus on device but when downloaded from play store Not Work 从 Play 商店下载应用程序时未加载同意书 - Consent form is not loading when App was downloaded from Play Store 从某些设备上的Google Play商店下载时发生错误ClassNotFoundException - Error ClassNotFoundException when downloaded from Google Play store on some devices ClassNotFoundException:如果Android应用是从Play商店下载的 - ClassNotFoundException: if Android App downloaded from play store 从App Store或Google Play下载时,Android App无法正常工作 - ANR - Android App not working when downloaded via App Store or Google Play - ANR 从Play商店下载后,应用程序崩溃了吗? - App crashes after downloaded from Play Store? 视图在onResume()中已变为空-但仅在从Play商店下载的应用中 - View has become null in onResume() - But only in app downloaded from Play Store
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM