简体   繁体   中英

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. Otherwise it does not start. For this I use getInstallerPackageName() by checking if the name is com.android.vending.

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. 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. When it is null, this would usually mean that the apk was not downloaded from Google Play Store. 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". Does anybody have a clue if it is possible that this value is null, even if it is downloaded from Google Play Store?

This sounds like an implementation detail bug with Google Play pre-launch report. Please could you contact Google Play support and let them know the problem. Checking your install came from Google Play should be a reasonable thing to do. 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.

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). Please could you contact Google Play support and let them know the problem. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM