fbAudienceNetwork.*

Type Library
Revision Release 2024.3703
Keywords ads, advertising, Facebook Audience Network, fbAudienceNetwork
Platforms Android, iOS

Overview

The Facebook Audience Network plugin allows developers to monetize their mobile app with Facebook banner, rewarded and static interstitial ads.

Important

Facebook has a method for calling test ads which is different from other Solar2D ad providers. To test ads during implementation of this plugin, you must follow their requirements. Please read the notes in the fbAudienceNetwork.init() documentation and follow the steps to enable test ads.

Registration

Before you can use the Facebook Audience Network, you must set up Audience Network in your app.

Syntax

Facebook Audience Network
local fbAudienceNetwork = require( "plugin.fbAudienceNetwork" )

Functions

fbAudienceNetwork.init()

fbAudienceNetwork.show()

fbAudienceNetwork.hide()

fbAudienceNetwork.getSize()

fbAudienceNetwork.isLoaded()

fbAudienceNetwork.load()

Events

adsRequest

Project Settings

To use this plugin, add an entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase.

Facebook Audience Network
settings =
{
    iphone =
    {
        plist = {
            SKAdNetworkItems = {
                { SKAdNetworkIdentifier = "v9wttpbfk9.skadnetwork" },
                { SKAdNetworkIdentifier = "n38lu8286q.skadnetwork" },
            },
        },
    },
    plugins =
    {
        ["plugin.fbAudienceNetwork"] =
        {
            publisherId = "com.coronalabs"
        },
    },
}
Note

For Android, the following permissions/features are automatically added when using this plugin:

  • "android.permission.INTERNET"
  • "android.permission.ACCESS_WIFI_STATE"

Sample project