Jump to: navigation, search

Ad system API

Revision as of 14:48, 22 October 2014 by Huangyanli (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Configure listener

The User system has a callback. You need to configure a listener class and implement the listener method.
class Ads:public AdsListener
{
public:
    virtual void  onAdsResult(AdsResultCode code, const char* msg);
}
The Developer needs to implement onActionResult method
if(AgentManager::getInstance()->getAdsPlugin())
{
    AgentManager::getInstance()->getAdsPlugin()->setAdsListener(this);
}

Ad categories

Banner ads are used on a small portion of the screen to attract users to click for a full screen experience (for example a webpage or an app store screen)

Interstitials

Interstitials are Interstitial ads usually in the form of full screen pages that appears in between screens when user is browsing.

Recommended apps

Recommended apps

Point tracker wall

Point tracker wall is an app that tracks various points (recommended quality apps among downloaded installs, registered and Autofill information etc.) and provides points to users for each assignment they complete. When a user completes a task on a device that has the point tracker wall embedded, the developer of this app can receive corresponding profit.

Related API

Callback information

Callback information code msg
Received ad kAdsReceived simple description of null or error information
Ad display kAdsShown simple description of null or error information
Hide ad kAdsDismissed simple description of null or error information
Successfull point configuration kPointsSpendSucceed simple description of null or error information
Failed point configuration kPointsSpendFailed simple description of null or error information
Network error kNetworkError simple description of null or error information
Unknown error kUnknownError simple description of null or error information
Point Changed kOfferWallOnPointsChanged the changing number

Developers can determine whether this ad SDK supports this type of ad by using bool isAdTypeSupported(AdsType adsType)

Ad type Identifier
Banner AD_TYPE_BANNER
Interstitial AD_TYPE_FULLSCREEN
Recommend apps AD_TYPE_MOREAPP
Point tracker wall AD_TYPE_OFFERWALL
	
void Ads::hideAds()
{
    AdsPlugin* ads = AgentManager::getInstance()->getAdsPlugin();

    if( ads && ads->isSupportFunction(AD_TYPE_FULLSCREEN) )
    {
        ads->hideAds(AD_TYPE_FULLSCREEN);
    }
}

Ad preloaded

void preloadAds(AdsType adsType, int idx = 1);
To preload ads, pass the ad type that should be preloaded.
parameter description:adsType is Ad type,idx is the order of sets of parameters in AnySDK`s Packaging tool
Take a example
void Ads::preloadAds()
{
    AdsPlugin* ads = AgentManager::getInstance()->getAdsPlugin();

    if( ads && ads->isSupportFunction(AD_TYPE_FULLSCREEN) )
    {
        ads->preloadAds(AD_TYPE_FULLSCREEN);
    }
}

Ad displayed

void showAds(AdsType adsType, int idx = 1);
To display ads, pass the ad type that should be shown.
parameter description:adsType is Ad type,idx is the order of sets of parameters in AnySDK`s Packaging tool
Take a example
void Ads::showAds()
{
    AdsPlugin* ads = AgentManager::getInstance()->getAdsPlugin();

    if( ads && ads->isSupportFunction(AD_TYPE_FULLSCREEN) )
    {
        ads->showAds(AD_TYPE_FULLSCREEN);
    }
}

Hide ads

void hideAds(AdsType adsType, int idx = 1);
Hide related ads by passing ad types that need to be hidden.
parameter description:adsType is Ad type,idx is the order of sets of parameters in AnySDK`s Packaging tool
Take a example
void Ads::hideAds()
{
    AdsPlugin* ads = AgentManager::getInstance()->getAdsPlugin();

    if( ads && ads->isSupportFunction(AD_TYPE_FULLSCREEN) )
    {
        ads->hideAds(AD_TYPE_FULLSCREEN);
    }
}

Track points

API: float queryPoints() Check points through this API

Consume points

API: void spendPoints(int points) Configure points through this API