Google Licensing

Status: Stable

Version: 1.2

Supported platforms:

 

Forum thread

What's new?

Version 1.2
Added APK expansion file download support

About Google Licensing

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.

Installation

Copy libs folder into your exported project.
Copy src folder into your exported project.
Add System.loadLibrary("googlelicensing"); to your main Activity
Add "com.giderosmobile.android.plugins.googlelicensing.GoogleLVL" as external class in your main Activity

Code example:

require "googlelicensing"

googlelicensing:setKey("your-public-key")

googlelicensing:addEventListener(Event.LICENSE_ALLOWED, function()
        AlertDialog.new("Enjoy the game", "You can playe the game, license verified", "Ok"):show()
end)

googlelicensing:addEventListener(Event.LICENSE_DENIED, function()
        AlertDialog.new("Buy the game", "You need to buy the game to play it", "Cancel", "Buy"):show()
end)

googlelicensing:addEventListener(Event.LICENSE_RETRY, function()
        AlertDialog.new("Please retry", "We can not verify your license right now. Please retry later.", "Ok"):show()
end)

googlelicensing:addEventListener(Event.ERROR, function(e)
	AlertDialog.new("Error", e.error, "Ok"):show()
end)

googlelicensing:checkLicense() -- check for license