The flash application plus tutorial video ads
The preparation for coding
Before reading this tutorial, please read getting started with flash ad to learn how to get library, how to install library, how configuration platform
Add advertising related as3 code
1.Import keymob related classes
import com.keymob.*;
2.Set the parameters of each advertising platform
Platform parameters in json format as follow
{
"isTesting":true,//Whether the test mode
"rateModel":1,//Advertising platform collation,0表示priority Is weight, each 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,key2 full 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 ,androidWill automatically be ignored
{"class":"KeymobAdapter","priority":50,"key1":"appid"},//keymob.com Since 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
KeymobAd.getInstance().initFromJSON(jsonString);
Parameter Description
- jsonString is above json configuration string containing configuration information of each advertising
platform
4.Load the video advertising
KeymobAd.getInstance().loadVideo();
5.Check whether the video advertising is loaded successfully
KeymobAd.getInstance().isVideoReady();
6.Show video advertising
KeymobAd.getInstance().showVideo();
7.Show Video Appropriately
Check whether ad is load successfully is a good practice
if(KeymobAd.getInstance().isVideoReady()){
KeymobAd.getInstance().showVideo();
}
Configuration changes
After writing the code, in accordance with the previous tutorial , add permissions configuration and Activity configuration information
More tutorial of add ad in app qq group 310513042 home