MoSync 3.3
Advertising Library

Classes

class  Ads::Banner
 Provides a widget that displays advertisement to the user. When the user taps a banner, it triggers an action programmed into the advertisement. Your application is notified when an action starts or stops. The banner works with NativeUI library. The banner can be added only to a NativeUI layout object. More...
class  Ads::BannerListener
 Listener for banner events. More...

Namespaces

namespace  Ads
 

MoSync Advertising API.


Files

file  Banner.h
 

Provides a widget that displays advertisement to the user.


file  BannerListener.h
 

Listener for banner events.


Enumerations

enum  Ads::BannerSize {
  Ads::BANNER_SIZE_DEFAULT = 0, Ads::BANNER_SIZE_RECT, Ads::BANNER_SIZE_IAB, Ads::BANNER_SIZE_LEADERBOARD,
  Ads::BANNER_SIZE_WP7_XLARGE, Ads::BANNER_SIZE_WP7_XXLARGE
}
 Size constants for a banner. More...

Functions

 Ads::Banner::Banner (MAUtil::String publisherID="", BannerSize bannerSize=BANNER_SIZE_DEFAULT)
virtual Ads::Banner::~Banner ()
virtual MAHandle Ads::Banner::getHandle () const
virtual int Ads::Banner::getWidth ()
virtual int Ads::Banner::getHeight ()
virtual void Ads::Banner::setVisible (const bool visible)
virtual bool Ads::Banner::isVisible ()
virtual void Ads::Banner::setEnabled (bool enable)
virtual bool Ads::Banner::isEnabled ()
virtual void Ads::Banner::requestContent (bool requestState)
virtual void Ads::Banner::addTestDevice (const MAUtil::String &testDevice)
virtual bool Ads::Banner::isReady ()
virtual int Ads::Banner::setBackgroundColor (const int color)
virtual int Ads::Banner::setTopBackgroundColor (const int color)
virtual int Ads::Banner::setBorderColor (const int color)
virtual int Ads::Banner::setLinkColor (const int color)
virtual int Ads::Banner::setTextColor (const int color)
virtual int Ads::Banner::setUrlColor (const int color)
virtual void Ads::Banner::addBannerListener (BannerListener *listener)
virtual void Ads::Banner::removeBannerListener (BannerListener *listener)
virtual void Ads::Banner::handleBannerEvent (const MAEvent &eventData)
virtual int Ads::Banner::setProperty (const MAUtil::String &property, const MAUtil::String &value)
virtual int Ads::Banner::setPropertyInt (const MAUtil::String &property, const int value)
virtual int Ads::Banner::setPropertyIntHexa (const MAUtil::String &property, const int value)
virtual int Ads::Banner::getPropertyInt (const MAUtil::String &property, int &resultCode)
virtual int Ads::Banner::getPropertyInt (const MAUtil::String &property)
virtual MAUtil::String Ads::Banner::getPropertyString (const MAUtil::String &property, int &resultCode)
virtual MAUtil::String Ads::Banner::getPropertyString (const MAUtil::String &property)
virtual void Ads::BannerListener::bannerFailedLoad (Banner *banner, int error)
virtual void Ads::BannerListener::bannerLoaded (Banner *banner)
virtual void Ads::BannerListener::bannerOnLeaveApplication (Banner *banner)
virtual void Ads::BannerListener::bannerOnDismiss (Banner *banner)

Variables

const MAUtil::String Ads::TEST_EMULATOR = "TEST_EMULATOR"
 This string specifies the emulator as a device that will receive test ads.

Enumeration Type Documentation

Size constants for a banner.

Enumerator:
BANNER_SIZE_DEFAULT 

Default banner of size 320 * 50. Available on iOS and Android platforms.

BANNER_SIZE_RECT 

Standard medium of size 300 * 250. Available only on Android platform.

BANNER_SIZE_IAB 

Full size banner of size 468 * 60. Available only on Android platform.

BANNER_SIZE_LEADERBOARD 

Size 728 * 90. Available only on Android platform.

BANNER_SIZE_WP7_XLARGE 

Size 300 * 50 - X-Large Banner Available only on Windows Phone 7.1.

BANNER_SIZE_WP7_XXLARGE 

Size 480 * 80 Available only on Windows Phone 7.1.


Function Documentation

Ads::Banner::Banner ( MAUtil::String  publisherID = "",
BannerSize  bannerSize = BANNER_SIZE_DEFAULT 
)

Constructor.

Parameters:
publisherIDPublisher ID(only for Android platform).
bannerSizeThe size of the banner.
virtual Ads::Banner::~Banner ( ) [virtual]

Destructor.

virtual MAHandle Ads::Banner::getHandle ( ) const [virtual]
Returns:
The handle of the banner.
virtual int Ads::Banner::getWidth ( ) [virtual]

Get the width of the banner.

Returns:
The width value.
virtual int Ads::Banner::getHeight ( ) [virtual]

Get the height of the banner.

Returns:
The height value.
virtual void Ads::Banner::setVisible ( const bool  visible) [virtual]

Show or hide the banner.

Parameters:
visibleIf true shows the banner, otherwise hides it.
virtual bool Ads::Banner::isVisible ( ) [virtual]

Check if the banner is visible.

Returns:
True if is visible, false otherwise.
virtual void Ads::Banner::setEnabled ( bool  enable) [virtual]

Enable or disable the banner. If a banner is disabled then the user cannot tap on it.

Parameters:
enableIf true enables the banner, otherwise disables it.
virtual bool Ads::Banner::isEnabled ( ) [virtual]

Check if the banner is enabled.

Returns:
True if enabled, false otherwise.
virtual void Ads::Banner::requestContent ( bool  requestState) [virtual]

Sets the request state of the ads. If set to true ads are starting to be requested, if set to false loading ads is stopped. Available only on Android. On iOS ads loading starts automatically at creation. Call requestContent(true) after the ad is created and/or after you set properties to it.

Parameters:
requestStateIf true ads are starting to be requested, otherwise the request for ads is stopped.
virtual void Ads::Banner::addTestDevice ( const MAUtil::String testDevice) [virtual]

Sets the devices that are going to receive test ads only. You should utilize this property during development to avoid generating false impressions. Causes test ads to be returned to a device. Available only on Android.

Parameters:
testDevicethe device ID. Use TEST_EMULATOR to get test ads in the emulator.
virtual bool Ads::Banner::isReady ( ) [virtual]

Returns true if the ad is successfully loaded and is ready to be shown. Available only on Android.

Returns:
True if the ad is loaded, false otherwise.
virtual int Ads::Banner::setBackgroundColor ( const int  color) [virtual]

Sets the coloration of test ads, specifically the background color. Available only on Android.

Parameters:
colorA hexadecimal color value, e.g. 0xFF0000.
Returns:
Any of the following result codes:
virtual int Ads::Banner::setTopBackgroundColor ( const int  color) [virtual]

Sets the coloration of test ads,specifically the gradient background color at top. Available only on Android.

Parameters:
colorA hexadecimal color value, e.g. 0xFF0000.
Returns:
Any of the following result codes:
virtual int Ads::Banner::setBorderColor ( const int  color) [virtual]

Sets the coloration of test ads, specfiically the border color. Available only on Android.

Parameters:
colorA hexadecimal color value, e.g. 0xFF0000.
Returns:
Any of the following result codes:
virtual int Ads::Banner::setLinkColor ( const int  color) [virtual]

Sets the coloration of test ads, specfiically the link text color. Available only on Android.

Parameters:
colorA hexadecimal color value, e.g. 0xFF0000.
Returns:
Any of the following result codes:
virtual int Ads::Banner::setTextColor ( const int  color) [virtual]

Sets the coloration of test ads, specfiically the text color. Available only on Android.

Parameters:
colorA hexadecimal color value, e.g. 0xFF0000.
Returns:
Any of the following result codes:
virtual int Ads::Banner::setUrlColor ( const int  color) [virtual]

Sets the coloration of test ads, specfiically the url color. Available only on Android.

Parameters:
colorA hexadecimal color value, e.g. 0xFF0000.
Returns:
Any of the following result codes:
virtual void Ads::Banner::addBannerListener ( BannerListener listener) [virtual]

Add an event listener for this banner.

Parameters:
listenerThe listener that will receive banner events for this banner.
virtual void Ads::Banner::removeBannerListener ( BannerListener listener) [virtual]

Remove the event listener for this banner.

Parameters:
listenerThe listener that receives banner events for this banner.
virtual void Ads::Banner::handleBannerEvent ( const MAEvent eventData) [virtual]

This method is called when there is an event for this banner.

Parameters:
eventDataThe data for the banner event.
virtual int Ads::Banner::setProperty ( const MAUtil::String property,
const MAUtil::String value 
) [protected, virtual]

Set a banner string property.

Parameters:
propertyA string representing which property to set.
valueThe string value which will be assigned to the property.
Returns:
Any of the following result codes:
virtual int Ads::Banner::setPropertyInt ( const MAUtil::String property,
const int  value 
) [protected, virtual]

Set a banner integer property.

Parameters:
propertyA string representing which property to set.
valueThe string value which will be assigned to the property.
Returns:
Any of the following result codes:
virtual int Ads::Banner::setPropertyIntHexa ( const MAUtil::String property,
const int  value 
) [protected, virtual]

Set a widget integer property, in hexadecimal base.

Parameters:
propertyA string representing which property to set.
valueThe integer value in hexadecimal which will be assigned to the property.
Returns:
Any of the following result codes:
virtual int Ads::Banner::getPropertyInt ( const MAUtil::String property,
int &  resultCode 
) [protected, virtual]

Get a widget property value as an integer, setting also the result code.

Parameters:
propertyA string representing which property to set.
resultCodeWill contain the result code of the syscall. Can be any of the following result codes:
Returns:
The property value.
virtual int Ads::Banner::getPropertyInt ( const MAUtil::String property) [protected, virtual]

Get a widget property value as an integer.

Parameters:
propertyA string representing which property to set.
Returns:
The property value.
virtual MAUtil::String Ads::Banner::getPropertyString ( const MAUtil::String property,
int &  resultCode 
) [protected, virtual]

Get a widget property as a string, setting also the result code.

Parameters:
propertyA string representing which property to set.
resultCodeWill contain the result code of the syscall. Can be any of the following result codes:
Returns:
The property value.
virtual MAUtil::String Ads::Banner::getPropertyString ( const MAUtil::String property) [protected, virtual]

Get a widget property as a string.

Parameters:
propertyA string representing which property to set.
Returns:
The property value.
virtual void Ads::BannerListener::bannerFailedLoad ( Banner banner,
int  error 
) [inline, virtual]

Called when a banner view fails to load a new advertisement.

Parameters:
bannerThe banner view that failed to load an advertisement.
errorDescribes the problem.
virtual void Ads::BannerListener::bannerLoaded ( Banner banner) [inline, virtual]

Called when a new banner advertisement is loaded.

Parameters:
bannerThe banner that failed to load an advertisement.
virtual void Ads::BannerListener::bannerOnLeaveApplication ( Banner banner) [inline, virtual]

Called when the user taps the banner view. The application is moved to background.

Parameters:
bannerThe banner that the user tapped.
virtual void Ads::BannerListener::bannerOnDismiss ( Banner banner) [inline, virtual]

Called after a banner view finishes executing an action that covered your application's user interface.

Parameters:
bannerThe banner view that finished executing an action.

Variable Documentation

const MAUtil::String Ads::TEST_EMULATOR = "TEST_EMULATOR"

This string specifies the emulator as a device that will receive test ads.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines