Type Function Return value none Revision 2017.3060 Keywords ads, advertising, Facebook Audience Network, fbAudienceNetwork, init See also fbAudienceNetwork.load() fbAudienceNetwork.show() fbAudienceNetwork.*
fbAudienceNetwork.init()
initializes the Facebook Audience Network.
Once initialized, you can load an ad using fbAudienceNetwork.load() and subsequently show it via fbAudienceNetwork.show().
Facebook has a method for calling test ads which is different from other Corona ad providers. To test ads during implementation of this plugin, you must follow their requirements as follows:
Test mode device hash: [HASHID]
This device hash can be used as one of the device hash IDs outlined below. For more information on accessing the device console log, see the Device Debugging sections of the Debugging Guide.
fbAudienceNetwork.init( adListener [, params] )
Listener. Listener function that will receive adsRequest events.
Table. Table containing additional parameters — see the next section for details.
The params
table includes the following additional parameters:
Array. Optional except when testing on devices. An array of device hash IDs, for instance { "deviceID1", "deviceID2" }
When you are ready to distribute the app or test with real ads, you should not pass the testDevices
parameter to this function.
Testing with real ads is a two-step process. The first step is to add testers to your app settings in the Facebook Developer Portal so they can see real ads before the app is approved. The second step is for those testers to be logged in to the Facebook app on the same device where your app is installed. See here for more information.
local fbAudienceNetwork = require( "plugin.fbAudienceNetwork" ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.isError ) end end -- Initialize the Facebook Audience Network fbAudienceNetwork.init( adListener )