Ads Interface

Status: Stable

Version: 1.7

Supported platforms:

   

Documentation Forum thread

What's new?

version 1.7
(IOS and Android)Revmob - upgraded sdk
(IOS and Android)Applovin - implemented sdk
(IOS)Amazon- implemented sdk
(Android)Admob - removed check for Google Play services

About Ads Interface

The idea is to provide common Ads interface for most of available ad frameworks, so that user's would not have to create a plugin for each of them separately, but rather it would be possible to wrap ad framework in single Java or Objective-C class (depending on the platform) and add it to the project, without even recompiling existing Ads Interface plugin.

Additionally it would be able to support multiple ad frameworks simultaneously so users could switch and fall back between ad frameworks on runtime.

So the benefits would be:
Using same interface not only across platforms, but also across ad frameworks
Providing ability to use multiple ad frameworks simultaneously
Making it easier to add new ad frameworks only by wrapping its functionality in Native interface

Installation

Android

Copy libs folder into your exported project
Copy src folder into your exported project
Copy res folder into your exported project
Add System.loadLibrary("ads"); to your main activity
Add "com.giderosmobile.android.plugins.ads.Ads" as external class in your main activity
You must install each ad framework you want to use based on their instalation instructions (usually adding .jar file to project and modifying AndroidManifest file)


IOS

Copy contents of Plugins directory into your exported project's Plugins directory
Add copied files to your Xcode project (Check create groups for added folders)

Code example:

require "ads"
admob = Ads.new("admob")
admob:setKey("a151c9c98a8857b")
admob:showAd("banner")
admob:setAlignment("center", "bottom")

admob:addEventListener(Event.AD_RECEIVED, function()
	print("Admob AD_RECEIVED")
end)

admob:addEventListener(Event.AD_FAILED, function(e)
	print("Admob AD_FAILED", e.error)
end)

admob:addEventListener(Event.AD_ACTION_BEGIN, function()
	print("Admob AD_ACTION_BEGIN")
end)

admob:addEventListener(Event.AD_ACTION_END, function()
	print("Admob AD_ACTION_END")
end)

admob:addEventListener(Event.AD_DISMISSED, function()
	print("Admob AD_DISMISSED")
end)

admob:addEventListener(Event.AD_ERROR, function(e)
	print("Admob AD_ERROR", e.error)
end)