Corona Labs is pleased to announce the immediate availability of a new plugin that lets you implement ads from AppLovin. Their platform uses real-time data to understand your users and target them with relevant brands, ensuring that you are reaching users who are likely to interact with your marketing. AppLovin delivers content to over a billion mobile users every month.
Signing up
To use AppLovin, you will need to sign up and get an AppLovin SDK key. Regardless of iOS or Android, you will get just one SDK key which should be used throughout your projects. Once you gain access to the AppLovin developer portal , navigate to the Account section, expand the Account menu on the left side, select Keys , and your SDK key should be revealed.
Including the plugin
As with all plugins, you must include AppLovin in your build.settings
file. For iOS, you just need the AppLovin plugin itself. For Android, you must also include the Google Play Services plugin since AppLovin needs to access library code within that plugin.
settings =
{
plugins =
{
["plugin.applovin"] =
{
publisherId = "com.coronalabs",
supportedPlatforms = { iphone=true, android=true, osx=true, ["win32-sim"]=true }
},
-- Include this for Android only
["plugin.google.play.services"] =
{
publisherId = "com.coronalabs",
supportedPlatforms = { android=true }
},
},
}
Setup and initialization
Similar to other plugins, you must require()
the plugin in any Lua file where you plan to call AppLovin’s APIs.
-- Require the AppLovin plugin
local applovin = require( "plugin.applovin" )
Next, add a basic AppLovin event listener (it can be completed later) and initialize the AppLovin plugin:
-- AppLovin listener
local function adListener( event )
end
-- Initialize the AppLovin plugin
applovin.init( adListener, { sdkKey="YOUR_SDK_KEY", verboseLogging=false } )
Note that the applovin.init() call takes two parameters: the event listener function name and a table of parameters. Inside the table of parameters, your unique SDK key is required. In addition, you can include the verboseLogging
key with a value of true
to output AppLovin logs to the console.
Loading and showing ads
AppLovin only offers graphical and video interstitial ads (no banners). The types displayed are controlled solely within the AppLovin developer portal, so there’s no need to specify any parameters in the load or show APIs. There is also no “hide” API since interstitial ads need to be closed by the user or played to completion before the app continues.
To load an ad, simply call the applovin.load() API:
applovin.load()
Then, to show it, simply call applovin.show():
applovin.show()
Similar to other ad providers, you can also call applovin.isLoaded() to check if an ad is loaded before showing it:
if applovin.isLoaded() then
applovin.show()
end
Event listener callbacks
All of the APIs mentioned above, with the exception of applovin.isLoaded(), will call the event listener function. The event table which is dispatched will contain various properties, including the following phases (event.phase
):
-
"init"
— Indicates that the AppLovin plugin was initialized successfully. -
"failed"
— Indicates that an ad failed to load. -
"loaded"
— Indicates that an ad loaded successfully. -
"displayed"
— Indicates that a graphical interstitial ad (non-video) was displayed. -
"hidden"
— Indicates that a graphical interstitial ad (non-video) was closed/hidden. -
"playbackBegan"
— Indicates that a video interstitial ad was displayed. -
"playbackEnded"
— Indicates that a video interstitial ad was closed/hidden. -
"clicked"
— Indicates that an ad was clicked/tapped.
For more information, please read the documentation or download the basic sample app from GitHub at https://github.com/coronalabs/plugins-sample-applovin.
Important notes
- The AppLovin app configuration screen has many options for configuring and controlling the types of ads you get. For instance, you can restrict the ads to “child safe” if the app is targeting children. You can change these settings as often as needed, but for an app released to market , you must also email applovin-support@coronalabs.com with a summary of your changes. This ensures that your ads and associated preferences will be delivered consistently.
- For monetization through the AppLovin plugin, Corona Labs takes a revenue share in the form of a fixed 5% flat rate.
In summary
With the addition of AppLovin, Corona Labs is committed to bringing you more and more monetization options for your apps. If you have any questions about this plugin, please discuss in the Corona forums.