Type CoronaLibrary Revision 2017.3060 Keywords license, licensing
The Corona licensing library lets you check to see if the app was bought from a store. Currently, only Google Play is supported.
For further information, see the Google licensing reference page.
-- config.lua
application =
{
content =
{
width = 800,
height = 1200,
scale = "letterbox"
},
license =
{
google =
{
-- The "key" value is obtained from Google
key = "Your key here",
-- The "policy" key is optional; its value can be either "serverManaged" (default) or "strict"
-- A value of "serverManaged" will query the Google server and cache the results (this is similar to Google's "ServerManagedPolicy")
-- A value of "strict" will not cache the results, so when there's a network failure, the licensing will fail (this is similar to Google's "StrictPolicy")
policy = "serverManaged"
},
},
}
-- -------------------------------------------------------------------------------
-- main.lua
local licensing = require( "licensing" )
licensing.init( "google" )
local function licensingListener( event )
if not ( event.isVerified ) then
-- Failed to verify app from the Google Play store; print a message
print( "Pirates!!!" )
end
end
licensing.verify( licensingListener )