Difference between revisions of "Ads"
Line 2: | Line 2: | ||
'''Supported platforms:''' <br/> | '''Supported platforms:''' <br/> | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
− | === Description === | + | === <translate>Description</translate> === |
<translate>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. | <translate>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. | ||
Line 8: | Line 8: | ||
More information available in [http://docs.giderosmobile.com/interface/ads](Ads interface guide).</translate> | More information available in [http://docs.giderosmobile.com/interface/ads](Ads interface guide).</translate> | ||
− | === Examples === | + | === <translate>Examples</translate> === |
'''Creating fallbacks with Ads frameworks'''<br/> | '''Creating fallbacks with Ads frameworks'''<br/> | ||
<source lang="lua">--require plugin | <source lang="lua">--require plugin | ||
Line 39: | Line 39: | ||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Methods === | + | === <translate>Methods</translate> === |
[[Special:MyLanguage/Ads.new|Ads.new]] ''<translate>initializes new ad framework</translate>''<br/> | [[Special:MyLanguage/Ads.new|Ads.new]] ''<translate>initializes new ad framework</translate>''<br/> | ||
[[Special:MyLanguage/Ads:enableTesting|Ads:enableTesting]] ''<translate>enable testing ads</translate>''<br/> | [[Special:MyLanguage/Ads:enableTesting|Ads:enableTesting]] ''<translate>enable testing ads</translate>''<br/> | ||
Line 57: | Line 57: | ||
[[Special:MyLanguage/Ads:showAd|Ads:showAd]] ''<translate>display ad</translate>''<br/> | [[Special:MyLanguage/Ads:showAd|Ads:showAd]] ''<translate>display ad</translate>''<br/> | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Events === | + | === <translate>Events</translate> === |
[[Special:MyLanguage/Event.AD_ACTION_BEGIN|Event.AD_ACTION_BEGIN]]<br/> | [[Special:MyLanguage/Event.AD_ACTION_BEGIN|Event.AD_ACTION_BEGIN]]<br/> | ||
[[Special:MyLanguage/Event.AD_ACTION_END|Event.AD_ACTION_END]]<br/> | [[Special:MyLanguage/Event.AD_ACTION_END|Event.AD_ACTION_END]]<br/> | ||
Line 64: | Line 64: | ||
[[Special:MyLanguage/Event.AD_FAILED|Event.AD_FAILED]]<br/> | [[Special:MyLanguage/Event.AD_FAILED|Event.AD_FAILED]]<br/> | ||
[[Special:MyLanguage/Event.AD_RECEIVED|Event.AD_RECEIVED]]<br/> | [[Special:MyLanguage/Event.AD_RECEIVED|Event.AD_RECEIVED]]<br/> | ||
− | === Constants === | + | === <translate>Constants</translate> === |
|} | |} |
Revision as of 07:26, 24 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");
MethodsAds.new initializes new ad framework |
EventsEvent.AD_ACTION_BEGIN Constants |