Add to build.settings
plugins = {
['plugin.fyber'] = {
publisherId = 'com.spiralcodestudio',
supportedPlatforms = {
iphone = {url = 'https://.../plugin.fyber.stub.tgz'},
android = {url = 'https://.../plugin.fyber.android.tgz'},
macos = false,
win32 = false
}
}
}
Require the plugin in Lua.
local fyber = require('plugin.fyber')
Initialize the plugin. Call it before using the plugin. However, you might want to provide a user consent information for better offers before calling fyber.init(). See fyber.setGdprConsentData().
app_id, string. App id.security_token, string. Security token.user_id, string, optional. Unique user id. Don't set for automatic user id.should_close_offerwall. boolean, optional. Iftrueautomatically close the offerwall on offer selection.listener, function. Listener receives fyber events.
local json = require('json')
fyber.init{
app_id = '123456',
security_token = 'fankjfsy47tia7jhgg4783t4has984',
--user_id = '',
--should_close_offerwall = true,
listener = function(event)
print(json.prettify(event))
end
}
Events regarding the offerwall.
name, string,'fyberOfferWall'.phase, string.'load'- the offerwall has been loaded or failed to load.'close'- the offerwall has been closed.isError, boolean,truein case of an error loading the offerwall.errorMessage, string, error description. If the offerwall is not available the message would be'No ad available.'.
Events regarding the virtual currency.
name, string,'fyberVirtualCurrency'.isError, boolean,truein case of an error.errorMessage, string, error description.currencyId, string, currency id.currencyName, string, currency name.deltaOfCoins, number, the difference in the total amount of coins.latestTransactionId, string, transaction id.isDefault, boolean,trueif the default currency.
Load the offerwall. On load a fyberOfferWall event is dispatched.
fyber.loadOfferWall()
Returns true if offerwall is loaded.
local is_loaded = fyber.isOfferWallLoaded()
print(is_loaded)
Shows a loaded offerwall.
fyber.showOfferWall()
Requests an update for virtual currencies. A fyberVirtualCurrency event is dispatched.
fyber.requestVirtualCurrency()
is_consent_given, boolean, optional. Set totrueif user gave consent,falseif user refused to give consent or don't set a value to indicate that user didn't do anything.consent_data, string, optional. Consent data.
fyber.setGdprConsentData{
is_consent_given = true,
consent_data = 'CONSENT DATA'
}
Clears any previous consent information.
fyber.clearGdprConsentData()