• 4

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

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?

      • 1
    • What sort of output do you expect when using adb install yourApk.apk or when the APK is shared via bluetooth?
      • 2
    • @Shark That is the question, if it's a vendor-specific problem. If so, I have to remove this check from my app. It was null with Google Pixel 2 and Samsung Galaxy S9 in this pre-launch report. But it worked with all the other test devices from the pre-launch report in Google Play Developer Console. When you not install it via Google Play, that means via adb install, then it's null (what is the expected value). I don't allow it to install it from somewhere else than Google Play Store. I think the only real solution would be to find some1 with a Samsung Galaxy S9 to check it on a real device.
      • 2
    • This isn't a critique but you may want to reconsider not allowing installations from anywhere but GooglePlay; users in some countries have very expensive mobile data (and very low wifi coverage) that they simply "share" apps by sending APKs via Bluetooth. So, it's just a heads-up to have in mind.
    • @Shark My app won't be released in such countries, so this probably will not be a problem. If I don't find a solution for this problem within the next days, then I have to disable it anyway.

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.

  • 1
Reply Report
    • I already sent a report two or three days ago to figure out what's going on here. No answer yet. But this does not seem to be a Google Play bug, because why do the other 7 devices work? If a bug, then no device should work imo. As I did some research, I figured out that Samsung did not(!) implement getInstallerPackageName() in earlier versions years ago, so it always returned null. I also read that HTC returns null as well. Obviously it's a problem of lousy vendors. Due to all these uncertainties I release to PROD without this feature for now (until I have more clearness)