Ads

Inherits: EventDispatcher

Supported platforms:

Available since version: Gideros 2011.6

Description:

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.
More information available in Ads interface guide.

Installation guide:

Android

Choose the frameworks you will use and delete all the unneeded based on file dependency table for each framework below

Copy libs folder into your exported project

Copy src 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

Modify AndroidManifest application tag and AndroidManifest permissions based on the frameworks you want to use using Ads Interface Guide

IOS

Choose the ad frameworks you will use and delete all the unneeded files based on file dependency table from Ads Interface

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)

Add IOS frameworks that is required by your selected Ad provider/p>

  • In the project navigator, select your project
  • Select your target
  • Select the 'Build Phases' tab
  • Open 'Link Binaries With Libraries' expander
  • Click the '+' button
  • Select framework
  • Click Add

Add Other Linker flags that is required by your selected Ad provider from Ads Interface Guide

Common uses and examples:

Creating fallbacks with Ads frameworks

--require plugin
require "ads"

--initialize amazon
amazon = Ads.new("amazon")
amazon:setKey("amazon-key")

--initialize admob
admob = Ads.new("admob")
admob:setKey("admob-key")

--if amazon fails
--show admob
amazon:addEventListener(Event.AD_FAILED, function(e)
	print("amazon AD_FAILED", e.error)
	admob:showAd("auto")
end)

--if admob fails
--show amazon
admob:addEventListener(Event.AD_FAILED, function(e)
	print("admob AD_FAILED", e.error)
	amazon:showAd("auto")
end)

--start displaying amazon ads
amazon:showAd("auto");

Methods, events and properties: