Ads

From GiderosMobile
Revision as of 09:57, 3 September 2018 by Hgy29 (talk | contribs)


Supported platforms:
Available since: Gideros 2011.6
Inherits from: EventDispatcher

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 [1](Ads interface guide).

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

Ads.new initializes new ad framework
Ads:enableTesting enable testing ads
Ads:get gets property value of the ad
Ads:getHeight gets the height of the ad
Ads:getPosition gets x and y position of the ad
Ads:getWidth gets width of the ad
Ads:getX gets x position of the ad
Ads:getY gets y position of the ad
Ads:hideAd hides ads
Ads:set sets property value of the ad
Ads:setAlignment sets alignment of the ad
Ads:setKey set keys for the framework
Ads:setPosition sets position of the ad
Ads:setX Sets x position of the ad
Ads:setY sets y position of the ad
Ads:showAd display ad

Events

Event.AD_ACTION_BEGIN
Event.AD_ACTION_END
Event.AD_DISMISSED
Event.AD_ERROR
Event.AD_FAILED
Event.AD_RECEIVED

Constants