Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Checking app store for ownership of premium version — Gideros Forum

Checking app store for ownership of premium version

PaulHPaulH Member
edited March 2017 in General questions
Hey, all. Does anyone have a premium (paid) app made with Gideros check with the app store to confirm the user owns it? In a non-Gideros app for Android I use com.google.android.vending.licensing.LicenseChecker. You create a LicenseChecker, give it a callback class and the public key for the app from the Google developer console, and lets you know if the user actually owns the app. That's useful because you can then make your premium app recognize when it's not owned (installed from a pirated APK) and act like the free version of the app.

Does anyone do anything similar with a Gideros app? I'm experimenting with adding the license checker to the main activity exported by Gideros, but I don't want to risk introducing conflicts with the in-app billing plugin.

Paul

Comments

  • antixantix Member
    I have wondered about this myself. This kind of functionality would be a great addition to Gideros ;)
  • PaulHPaulH Member
    I'm still experimenting, but it looks promising. Adding the licensing library to the exported project, and adding some code to onCreate in the main activity, the LicenseChecker is running. I'm having it write its results in a file in data/data/appname/files/, the Android folder equivalent to "|D|" in Gideros, so the Lua code can see the results without adding all the layers required to make a plugin. The license checker isn't getting me the expected result yet, but I'm guessing that may be because the APK I'm testing isn't a version the store has seen. I'm publishing to beta in Google Play in the hopes that the license checker will report back correctly if the app was actually installed through the store.
  • SinisterSoftSinisterSoft Maintainer
    edited April 2017
    "Google Play offers a licensing service that lets you enforce licensing policies for applications that you publish on Google Play. With Google Play Licensing, your application can query Google Play at run time to obtain the licensing status for the current user, then allow or disallow further use as appropriate.
    This is the plugin to implement the querying and verification process.
    Additional this plugin performs needed checks for downloading expansion files and handles its downloads."

    http://giderosmobile.com/labs/google-licensing

    Likes: antix

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • I just looked and the google licensing plugin should be in the list of available plugins - but it isn't... hopefully this will be fixed for the 2017.4 version.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • @sinistersoft, this plugin shows as a premium feature, this sign should be removed.
  • SinisterSoftSinisterSoft Maintainer
    edited April 2017 Accepted Answer
    Yes.

    I'm still looking into why it's not in the list of export plugins, it should be there as there is a gplugin for it.

    When it does appear, this is how you use it:
    pcall(function() require "googlelicensing" end)
    if googlelicencing then
    	googlelicencing:setKey(googleLicence)
     
    	googlelicensing:addEventListener(Event.LICENSE_ALLOWED,function()
    		print("License verified")
    	end)
     
    	googlelicensing:addEventListener(Event.LICENSE_DENIED,function()
    		print("License denied")
    	end)
     
    	googlelicensing:addEventListener(Event.LICENSE_RETRY,function()
    		print("Unable to verify licence")
    	end)
     
    	googlelicensing:addEventListener(Event.DOWNLOAD_REQUIRED,function()
    		print("Download required")
    	end)
     
    	googlelicensing:addEventListener(Event.DOWNLOAD_NOT_REQUIRED,function()
    		print("Download not required")
    	end)
     
    	googlelicensing:addEventListener(Event.DOWNLOAD_STATE,function(e)
    		print("Download state:",e.state,e.message)
    	end)
     
    	googlelicensing:addEventListener(Event.DOWNLOAD_PROGRESS,function(e)
    		print("Download progress",e.speed,e.timeLeft,e.progress,e.total)
    	end)
     
    	googlelicensing:addEventListener(Event.ERROR,function(e)
    		print("Licence/Download error:",e.error)
    	end)
     
    	googlelicensing:checkLicense()
    	--googlelicensing:checkExpansion() -- check for license
    	--googlelicensing:cellularDownload(true)
    else
    	print("Licensing unavailable")
    end

    Likes: antix

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • You can find the licence id in the google play store backend, look in the 'Services & APIs' section.

    It's the "Base64-encoded RSA public key".

    The same code is used for IAB, so if you use that the maybe you should set the key to a string and use that same string for both api calls.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • antixantix Member
    Looking forward to trying this out :)
  • PaulHPaulH Member
    Good to know. Thank you! My experimental addition of the LicenseChecker to the main activity worked as well. I'd be happy to share the code I used, but it looks like it will be easier for people to just use this plugin.

    Thanks again,

    Paul

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
  • antixantix Member
    Thanks @PaulH but yes I'd rather use the plug-in system. If I never have to use Android Studio again I'll be really happy :)

    Of course I still have to use it to dump logcat stuff :)
Sign In or Register to comment.