Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Android Protector - Anti-Piracy

Discussion in 'Assets and Asset Store' started by HemiMG, Sep 17, 2014.

  1. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I just released a new asset on my website, and will shortly be submitting it to the Asset store.

    We recently released our first Unity game to Google Play for free and I was pleased to see the install count in Chartboost was quite high. Though not so pleased to see that the eCPM was a few cents. Later I checked the Google Play numbers and found out that less than 1% of the Chartboost installs were accounted for. I found out through Applovin's developer console that several clones of our game had been made with new package names and submitted to Chinese stores. Since Chinese users aren't very likely to have Google Play installed, this wreaks havoc on our monetization strategy. And being a numbers geek, the damage it did to our analytics nearly gave me fits!

    So, I created Android Protector to provide a first layer of defense against the type of simple, automated things that can allow a game to get hijacked and submitted by another developer. My primary goal was to figure out when to disable ads and in-app purchases to keep my numbers somewhere near meaningful, but it can be used to completely shut down the game or do whatever else you choose to do with the information.

    Of course, determined pirates will get around anything. But our game was brand new, with no following, and judging by the legitimate download count, not a lot of interest. As most indie games are when they are first starting out. Not something that someone is going to spend more than a few minutes trying to crack. Android Protector will work great in those circumstances.

    It can perform three checks, each individually so you can decide which ones you want to use and what you want to do about it. First, it can verify that the package name of the app is the same as the one that you set in Unity. Second, it can verify that the game was actually downloaded from Google Play or the Amazon Appstore (you set which one to check for in the prefab). Finally, it can check to see if Google Play or the Amazon Appstore exists on the device running the game, so you'll know if it is even possible to monetize those users with ads or in-app purchases.

    You can purchase it here: http://www.imperialpenguin.com/androidprotector/
    Or on the asset store, here: https://www.assetstore.unity3d.com/en/#!/content/21998
     
    Last edited: Oct 1, 2014
  2. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Cool, but what about other appstore other than gooleplay/amazon. And if they resign the apk, how can you verify it is the same package name I set?
     
  3. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I can support any app store that I can find the package name for and that sets the installer package name. It's fairly easy to add them with just 3 lines of code. So if there's one you have in mind, let me know and I'll see if I can get the information I need to support it.

    The package name is tested by having you create a hash of the name you chose, along with a salt value that you pass to the method. There's a method to create the hash and print it to the console so you'll know what value to put into the verification method for the hash. On the java side, it then gets the package name for the application and compares the two.
     
  4. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
  5. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I've just uploaded version 1.1 to my website and submitted it to the asset store. This version adds support for Samsung Apps. Although that store does not set the installer package name, so the installer check for that platform will always return valid.

    I've also added a new method, CheckOtherStore, that will allow you to check for a store other than the one you are installing to. I figure if you deploy to Samsung Apps, you may be curious whether or not Google Play is installed on the device and this method allows you to check for that.
     
  6. FS9606

    FS9606

    Joined:
    Mar 12, 2015
    Posts:
    21
    these two items:
    Google Play Package Name Verification.
    Google Play Store Presence Verification.
    are they dependable verifications?
     
  7. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Sorry for the delay. I guess that depends on what you mean by dependable. Pretty much anything at all can be circumvented. Even the largest companies haven't solved the piracy issue. But they are as dependable as any other anti-piracy measure. The Play store can be spoofed, but getting the package name in the game to match the one that you set at build time would take a lot more work on the effort of any would be cracker.
     
  8. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    seriously this should be in unity by default, i ll be so mad even tho it s impossible to stop piracy, but months or years of development hack by someone just like that , it s just hard to swallow.
    thanks for releasing such asset.
     
    Michieal likes this.
  9. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I've come to accept that users will pirate paid apps, but what really got my goat was when people were putting unauthorized copies of our free game on Chinese app stores.
     
    Michieal likes this.
  10. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    705
    So, does this support Apple store & Wp8 store too?
    Or just Android?
     
  11. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    It just works on Android. That's where I had the biggest problem with pirates, and I'm not sure of a reliable way to check for piracy on Apple or WP8.
     
  12. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    622
    Does it work with the latest Unity 5? I need it to check if my game was installed from Google Play store or not.
     
  13. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I haven't tried it on Unity 5 yet because I've moved away from mobile development but I don't think there's anything in there that is version specific.
     
  14. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    622
    I will try your plugin and tell you if there is any error. Thanks
     
  15. SteveF

    SteveF

    Joined:
    Dec 1, 2013
    Posts:
    5
    Hi, just bought android protector and i'm trying to get it to work. I think i've done everything correctly but when i run on device it has a null reference exception on this line (in CheckBundle):

    string retVal = instance.androidClass.CallStatic<string>("checkBundle", args);

    The error i'm getting is:

    NullReferenceException: Object reference not set to an instance of an object
    at AndroidProtector.CheckBundle (System.String bundle, System.String mainKey, System.String returnKey) [0x0002d] in /Circles Game/Assets/AndroidProtector/AndroidProtector.cs:45

    Any ideas on how to fix it? I'm using Unity version 5.3.7
     
  16. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I'm sorry, I just saw your post. Did you get it to work? I'm not at the computer that has the project on it right now, so I can't take a look. But if you haven't gotten it to work I'll try to take a look tonight.
     
  17. ExcellS23

    ExcellS23

    Joined:
    Sep 22, 2015
    Posts:
    9
    Hey, I was interested in purchasing your plugin, but I'm holding back due to the last question not being addressed. Were you able to update the above issue? <"NullReferenceException: Object reference not set to an instance of an object
    at AndroidProtector.CheckBundle (System.String bundle, System.String mainKey, System.String returnKey) [0x0002d] in /Circles Game/Assets/AndroidProtector/AndroidProtector.cs:45
    ">