2.Advertising

2.1 Set AD result callback

Android

ADNative.setAdResultCallback(AdParamCallback callback);

Example:

ADNative.setAdResultCallback(new ADManager.AdParamCallback() {

    @Override
    public void onStatusChanged(ADParam arg0, int status) {
        // TODO Auto-generated method stub
        Log.d(TAG,"onStatusChanged:"+status);
    }

    @Override
    public void onRequestAddGameCoin(ADParam arg0, int arg1, int arg2,
            String arg3) {
        // TODO Auto-generated method stub
        Log.d(TAG,"onRequestAddGameCoin");

    }

    @Override
    public void onOpenResult(ADParam adParam, int result) {
        // TODO Auto-generated method stub
        Log.d(TAG,"onOpenResult:"+result);
        //Determine if the ad type is a video
        if(adParam.getType().equals(ADDef.AD_TypeName_Video)){

        }

        if(result== ADParam.ADOpenResult_Success){//open success

        }
        else {//open fail

        }
    }
});

Callback Description: AdParamCallback .onOpenResult(onOpenResult(ADParam adParam , int result)) :the result of openAd

  • adParam: param of ad.

  • result: 0-success 1-fail 2-cancel

AdParamCallback.onRequestAddGameCoin(ADParam adParam, int result, int num, String reason):for integer wall(Depreciation)

  • adParam: the param of ad

  • result:the result of openAd:0-success 1-fail 2-cancel

  • num:the num of coin for rewards

  • reason:reason for failure

2.2 Open AD

2.2.1 Open the general AD(interstitial/reward video/banner/splash)

Android

iOS

Callback Description:

adCallback:^(BOOL flag, KTMADType type):the callback of ad result。

  • flag:true-open success false-open fail (note:If the video play complete,flag will be true.)

  • type : KTMADTypePlaque(plaque),KTMADTypeVideo(video)

Note: you shold close backgroud music when plaque or video open success.

Parameters:

  • adPositionName: the name of position.

Unity

Example:

Parameters:

  • adPositionName: the name of position

  • callBackFun:the callback of openAd

Creator

Example:

  • Parameters:

    • adPositionName: the name of position

    • callBackFun:the callback of openAd

2.2.2 Open the native AD(interstitial/reward video/banner/splash)

Android

params:

  • adPositionName: the name of AD position

  • width:width on the screen, in pixels

  • height:height on the screen, in pixels

  • x:X in the upper left corner,in pixels

  • y:Y in the upper left corner,in pixels

  • limitSize:We strongly recommend that you choose 1

iOS

params:

  • adPositionName: the name of AD position

  • width:width on the screen, in pixels

  • height:height on the screen, in pixels

  • x:X in the upper left corner,in pixels

  • y:Y in the upper left corner,in pixels

Unity

params:

  • adPositionName: the name of AD position

  • width:width on the screen, in pixels

  • height:height on the screen, in pixels

  • x:X in the upper left corner,in pixels

  • y:Y in the upper left corner,in pixels

  • limitSize:We strongly recommend that you choose 1

params:

  • adPositionName:the name of AD position

  • rect:Unity's coordinate region

params:

  • adPositionName: the name of AD position

  • width:width on the screen, in pixels

  • height:height on the screen, in pixels

  • x:X in the upper left corner,in pixels

  • y:Y in the upper left corner,in pixels

  • winSizeW:Design resolution screen width

  • winSizeH:Design resolution screen height

Creator

params:

  • adPositionName: the name of AD position

  • width:width on the screen, in pixels

  • height:height on the screen, in pixels

  • x:X in the upper left corner,in pixels

  • y:Y in the upper left corner,in pixels

  • callBackFun:the callback of openAd

2.3 IS AD Ready

Android

iOS

Unity

Parameters:

  • adPositionName:the name of position

  • type: Ad type (plaque, video, banner, wall, splash, msg)

Creator

Parameters:

  • adPositionName:the name of position

2.4 Close AD

Android

iOS

Unity

Parameters:

  • adPositionName: the name of position

Creator

Parameters:

  • adPositionName: the name of position

2.5 Get video limit open number

Android

iOS

Unity

Return:

the num of limit open times,-1 is unlimited。

Creator

Return:

the num of limit open times,-1 is unlimited。

2.6 is AD Opened( Deprecated

Android

iOS

返回值:

  • true-ad display on screen

  • false-ad is not display on screen

2.7 Is AD be opened in level

Android

iOS

Unity

Parameters:

  • adPositionname:the name of position

  • lv:the number of level

Return:

  • true- support open

  • false-deny open

Creator

Parameters:

  • adPositionname:the name of position

  • lv:the number of level

Return:

  • true- support open

  • false-deny open

2.8 Is AD type exist

Android

iOS

Unity

Parameters:

  • adType:(plaque, video, banner, wall, splash, msg)

Return:

  • true-exist

  • false-not exist

Creator

Parameters:

  • adType:(plaque, video, banner, wall, splash, msg)

Return:

  • true-exist

  • false-not exist

2.9 Get AD position param

Android

iOS

Unity

Parameters:

  • positionName-the name of position

  • key-custom name

Return :

the value of input key.

Creator

Parameters:

  • positionName-the name of position

  • key-custom name

Return :

the value of input key.

最后更新于

这有帮助吗?