cordova應用加移動廣告平臺視頻廣告教程

1.設置各個廣告平臺的參數
平臺參數以json的格式組織,樣子以下。

{
"isTesting":true,//是不是測試模式
"rateModel":1,//廣告平臺排序規則,0表示priority是權重,各個平臺按比例顯示廣告,1表示priority是順序,各個平臺按順序展現廣告
"platforms":[

{"class":"AdmobAdapter","priority":90,"key1":"ca-app-pub-xxx/xxx","key2":"ca-app-pub-xxx/xxx"},//admob 平臺 ,key1 banner ID,key2全屏id
    
{"class":"AmazonAdapter","priority":20,"key1":"xxx"},//amazon 平臺 ,key1 appkey
    
{"class":"ChartboostAdapter","priority":40,"key1":"xxx","key2":"xxx"},//chartboost 平臺 ,key1 appID,key2 signature
    
{"class":"InmobiAdapter","priority":50,"key1":"xxx"},//inmobi 平臺 ,key1 appid

{"class":"IadAdapter","priority":50,"key1":"877393773"},//iad 平臺 ,android上會被自動忽略
    
{"class":"KeymobAdapter","priority":50,"key1":"appid"},//keymob.com 自售廣告,交叉推廣須要
    
{"class":"BaiduAdapter","priority":50,"key1":"appsid","key2":"appsec"},//baidu 平臺
    
{"class":"GDTAdapter","priority":50,"key1":"appid","key2":"banner id","param":"full id"},//廣點通 平臺
    {"class":"AdcolonyAdapter","priority":50,"key1":"appid","key2":"full id","param":"video id"},//adcolony 平臺
    
{"class":"MMediaAdapter","priority":10,"key1":"xxx","key2":"xxx"}//mmedia 平臺 ,key1 banner ID,key2全屏id
        ]
    }


2.初始化KeyMob
初始化KeyMob管理庫是調用其餘廣告功能函數的前提,必須先初始化才能作別的調用,下面是使用json配置文件的方式初始化KeyMob
KeyMob.initFromJSON(jsonString);


3.加載視頻廣告
KeyMob.loadVideo();


4.檢查視頻廣告是否加載成功
    KeyMob.isVideoReady(function (isReady) {
            if (isReady) {
               alert("Video is load success,you can show it now");
            }
        });


5.展現視頻廣告
KeyMob.showVideo();


6.flex顯示視頻廣告
顯示廣告前先加載,加載完成了再顯示,總體就是下面的樣式
       keymob.isVideoReady(function (isReady) {
            if (isReady) {
                keymob.showVideo();
            }
        });


KeyMob是一個專業的移動應用廣告管理工具,支持百度廣告,admob廣告,廣點通,mmedia,inmobi,chartboost,iad,adcolony視頻廣告等衆多流行廣告平臺。

android

相關文章
相關標籤/搜索