类型 函数 库 licensing.* 返回值 无 修订 版本 2024.3703 关键词 许可, 验证 另请参阅 licensing.init()
启动许可证验证流程。
如果目标商店与提供商不同,该函数将返回 false
并且不会调用监听器。您应该始终假设用户已通过验证,除非另有说明。
licensing.verify( listener )
local licensing = require( "licensing" ) -- Initialize licensing licensing.init( "google" ) local licensingListener = {} function licensingListener:licensing( event ) print( event.provider ) -- Provider for this licensing instance ("google") print( event.isVerified ) -- Boolean of true if license has been verified, otherwise false print( event.isError ) -- Boolean of true if there was an error during verification print( event.errorType ) -- Type of error: "configuration" or "network" (nil if no error) print( event.response ) -- Translated response from the licensing server print( event.expiration ) -- Expiration time of the cached license if ( event.isVerified ) then -- License successfully verified print( "Verified!" ) else -- Failed to verify app from the Google Play store print( "Failed!" ) end end -- Attempt to verify the license licensing.verify( licensingListener )