Difference between revisions of "Ads"

From GiderosMobile
Line 40: Line 40:
 
| style="width: 50%;"|
 
| style="width: 50%;"|
 
=== Methods ===
 
=== Methods ===
[[Ads.new]] - initializes new ad framework<br/>
+
[[Ads.new]] {{<translate>initializes new ad framework</translate>}}<br/>
[[Ads:enableTesting]] - enable testing ads<br/>
+
[[Ads:enableTesting]] {{<translate>enable testing ads</translate>}}<br/>
[[Ads:get]] - gets property value of the ad<br/>
+
[[Ads:get]] {{<translate>gets property value of the ad</translate>}}<br/>
[[Ads:getHeight]] - gets the height of the ad<br/>
+
[[Ads:getHeight]] {{<translate>gets the height of the ad</translate>}}<br/>
[[Ads:getPosition]] - gets x and y position of the ad<br/>
+
[[Ads:getPosition]] {{<translate>gets x and y position of the ad</translate>}}<br/>
[[Ads:getWidth]] - gets width of the ad<br/>
+
[[Ads:getWidth]] {{<translate>gets width of the ad</translate>}}<br/>
[[Ads:getX]] - gets x position of the ad<br/>
+
[[Ads:getX]] {{<translate>gets x position of the ad</translate>}}<br/>
[[Ads:getY]] - gets y position of the ad<br/>
+
[[Ads:getY]] {{<translate>gets y position of the ad</translate>}}<br/>
[[Ads:hideAd]] - hides ads<br/>
+
[[Ads:hideAd]] {{<translate>hides ads</translate>}}<br/>
[[Ads:set]] - sets property value of the ad<br/>
+
[[Ads:set]] {{<translate>sets property value of the ad</translate>}}<br/>
[[Ads:setAlignment]] - sets alignment of the ad<br/>
+
[[Ads:setAlignment]] {{<translate>sets alignment of the ad</translate>}}<br/>
[[Ads:setKey]] - set keys for the framework<br/>
+
[[Ads:setKey]] {{<translate>set keys for the framework</translate>}}<br/>
[[Ads:setPosition]] - sets position of the ad<br/>
+
[[Ads:setPosition]] {{<translate>sets position of the ad</translate>}}<br/>
[[Ads:setX]] - Sets x position of the ad<br/>
+
[[Ads:setX]] {{<translate>Sets x position of the ad</translate>}}<br/>
[[Ads:setY]] - sets y position of the ad<br/>
+
[[Ads:setY]] {{<translate>sets y position of the ad</translate>}}<br/>
[[Ads:showAd]] - display ad<br/>
+
[[Ads:showAd]] {{<translate>display ad</translate>}}<br/>
 
| style="width: 50%;"|
 
| style="width: 50%;"|
 
=== Events ===
 
=== Events ===

Revision as of 15:17, 23 August 2018

Supported platforms:
Available since: 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 [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 Template:Initializes new ad framework
Ads:enableTesting Template:Enable testing ads
Ads:get Template:Gets property value of the ad
Ads:getHeight Template:Gets the height of the ad
Ads:getPosition Template:Gets x and y position of the ad
Ads:getWidth Template:Gets width of the ad
Ads:getX Template:Gets x position of the ad
Ads:getY Template:Gets y position of the ad
Ads:hideAd Template:Hides ads
Ads:set Template:Sets property value of the ad
Ads:setAlignment Template:Sets alignment of the ad
Ads:setKey Template:Set keys for the framework
Ads:setPosition Template:Sets position of the ad
Ads:setX Template:Sets x position of the ad
Ads:setY Template:Sets y position of the ad
Ads:showAd Template:Display ad

Events

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

Constants