Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Application.installerName is inaccurate on some devices

Discussion in 'Android' started by RLin, May 25, 2020.

  1. RLin

    RLin

    Joined:
    May 10, 2015
    Posts:
    133
    I'm using Application.installerName to detect if the user installed the game from the Google Play Store or if they sideloaded a pirated copy of the game. If they have a pirated copy, the game throws an error.

    On legitimate copies from the Play Store, it should show com.android.vending. However, I am having an issue where Application.installerName is displaying com.google.android.packageinstaller on legitimate copies instead of indicating that the app was installed from the Play Store. This means the anti-piracy check fires for those copies, which is obviously bad.

    My question is, what causes installerName to show the wrong installer, and is there any way to check if an app actually was installed from Google Play? It seems that Android is able to figure this out, since sideloaded apps can't be updated through Google Play, so whatever mechanism does that could be repurposed for my anti-piracy check. However, I don't know how I would go about accessing that.
     
  2. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
  3. RLin

    RLin

    Joined:
    May 10, 2015
    Posts:
    133
  4. RLin

    RLin

    Joined:
    May 10, 2015
    Posts:
    133
    Anyone have any ideas?
     
  5. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    194
    Just wanted to jump in and say that I would like to use Application.installerName also, but not for anti-piracy. I just want to send the player to the correct store to rate the game (Amazon/Google Play).

    Have you found anything out about this?
     
  6. RLin

    RLin

    Joined:
    May 10, 2015
    Posts:
    133
    Nope, it is incredibly inconsistent. Even Application.InstallerMode is weird; some of my legitimate users are showing up as having their InstallerMode be developer build somehow.

    For my anti-piracy measures, I just ended up using remote settings to deactivate all versions of the app except for the latest, which means that people have to either get the game from the Play Store or wait with an unusable app while the pirated versions are still being pushed out.

    Since in your case though you just want to send players to the right store, what if you actually just created different versions of the app for the two stores? They would be identical except for a boolean flag you can set to false for one store and true for the other.
     
  7. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    194
    That's a great idea!

    I do use it for a little bit more than just the rate game, but it might suffice just to hard-code it. The problem is, I'll probably forget to set it at some point and regret it. It'd be great to have an automated method like the installerName, etc.

    Thanks for the info!
     
  8. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    513
    How the app is installed is a implementation detail that each flavor/verison of Android could vary.

    The best bet to verify a legitimate install from Google Play is to use App Licensing.
     
    Andrey-Postelzhuk likes this.
  9. MayhemMike

    MayhemMike

    Joined:
    Oct 23, 2013
    Posts:
    51
    Nice idea. How did it work out so far?