Hi everyone :)
The licensing init and verify functions works properly when the device is online only. If the device is offline the license.verify shows that app is not licensed. I have included to in config.lua to be serverManaged but the caching of license data is not working. So error message shows up when device is offline. What could be the issue?
config.lua
license = { google = { key = "LICENSE\_KEY HERE WAS INSERTED", policy = "serverManaged", }, },
main.lua
local licensing = require( "licensing" ) licensing.init( "google" ) googVerification = false local function licensingListener( event ) if not ( event.isVerified ) then -- Failed to verify app from the Google Play store; print a message googVerification = false local function onComplete( event ) if ( event.action == "clicked" ) then local i = event.index if ( i == 1 ) then -- Do nothing; dialog will simply dismiss local appStoreTarget = system.getInfo( "targetAppStore" ) if (appStoreTarget == "google") then local options = { supportedAndroidStores = { "google"} } native.showPopup( "appStore", options ) end -- appstore target conditional END end -- i==1 conditional END end -- event.action == clicked conditional END end -- onComplete func END native.showAlert( "Sheekore", "Please download this app for free from Play Store & check your network connection for verification to work.", { "OK" }, onComplete ) if (gpgs.isConnected()) then gpgs.logout() gpgsData.userPref = "logged out" loadsave.saveTable( gpgsData, "gpgsData.json" ) end --logout user if logged in else googVerification = true --- gpgs features local function gpgsLoginListener( event ) -- saving some dat here only end local function gpgsInitListener( event ) if not event.isError then -- Try to automatically log in the user with displaying the login screen if (gpgsData.firstTime == true ) then gpgs.login( { userInitiated = true, listener = gpgsLoginListener } ) gpgsData.firstTime = false loadsave.saveTable( gpgsData, "gpgsData.json" ) else if (gpgsData.userPref == "logged in" ) then gpgs.login( { listener = gpgsLoginListener } ) elseif (gpgsData.userPref == "logged out") then -- DO NOTHING end -- userPref conditional END end -- gpgs.isConnected conditional END end -- event.iserror conditional END end -- gpgsInitListener func END gpgs.init( gpgsInitListener ) --- gpgs features END end -- not event.isverified conditional END end licensing.verify( licensingListener )