Cordova application add video ads tutorial

The preparation for coding

Before reading this tutorial, please read the getting started with cordova tutorial to learn how to download management library, how to install AD management library

Add advertising related Js code

1.Set the parameters of the various advertising platform
Platform parameters in json format as follow
    	{
		"isTesting":true,//Whether the test mode
		"rateModel":1,//Advertising platform collation, 0 means is the priority weights, 
different platform scale display ads, 1 is the priority order, the platform to display ads in sequence
		"platforms":[
		{"class":"AdmobAdapter","priority":90,"key1":"ca-app-pub-xxx/xxx","key2":"ca-app-pub-xxx/xxx"},
//admob  platform  ,key1 banner ID,key2full  screen id
		{"class":"AmazonAdapter","priority":20,"key1":"xxx"},//amazon platform  ,key1 appkey
		{"class":"ChartboostAdapter","priority":40,"key1":"xxx","key2":"xxx"},
//chartboost platform  ,key1 appID,key2 signature
		{"class":"InmobiAdapter","priority":50,"key1":"xxx"},//inmobi platform  ,key1 appid
		{"class":"IadAdapter","priority":50,"key1":"877393773"},//iad platform  ,androidautomatically be ignored
		{"class":"KeymobAdapter","priority":50,"key1":"appid"},
//keymob.com ince the sale of advertising, cross promotion needs	
		{"class":"BaiduAdapter","priority":50,"key1":"appsid","key2":"appsec"},//baidu platform 
    {"class":"GDTAdapter","priority":50,"key1":"appid","key2":"banner id","param":"full id"},//wide point platform 
    {"class":"AdcolonyAdapter","priority":50,"key1":"appid","key2":"full id","param":"video id"},//adcolony platform 
		{"class":"MMediaAdapter","priority":10,"key1":"xxx","key2":"xxx"}
//mmedia platform  ,key1 banner ID,key2full  screen id
		]
	}
2. initialization Keymob
Initialization Keymob library management is the prerequisite to call other advertising functions, initialization Keymob using json config file as follow
keymob.initFromJSON(jsonString);
3.Load the video advertising
keymob.loadVideo();
4.Check whether the video advertising is loaded successfully
    keymob.isVideoReady(function (isReady) {
            if (isReady) {
               alert("Video is load success,you can show it now");
            }
        });
5.Show video advertising
keymob.showVideo();
6. Show video advertising
Check whether ad is load successfully is a good practice
   	keymob.isVideoReady(function (isReady) {
            if (isReady) {
                keymob.showVideo();
            }
        });

Processing for each platform

After add the code, in accordance with the previous tutorial, processing for android and ios

More tutorial of add ad in app   qq group 310513042   home