Android application display Video Ads

The preparation for coding

Before reading this tutorial, please read the android ads based tutorial to learn how to get access management of library, how to install AD management library, how to add advertising platform configuration information

Add advertising related Java code

1. import keymob related classes
    import com.keymob.networks.AdManager;
    import com.keymob.networks.core.*;
import com.keymob.sdk.core.AdTypes;
2.set the parameters of ad platforms
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	
//admob platforms ,key1 banner ID,key2 full screen id
		{"class":"AmazonAdapter","priority":20,"key1":"xxx"},//amazon platform ,key1 appkey
//chartboost platform ,key1 appID,key2 signature
		{"class":"InmobiAdapter","priority":50,"key1":"xxx"},//inmobi platform ,key1 appid
//iad platform ,androidandroid Will automatically be ignored
// 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
//mmedia platform ,key1 banner ID,key2full screenid
3.Initialization Keymob
Initialization Keymob library management is the prerequisite to call other advertising functions , the following is to init with the service
AdManager.getInstance().initFromKeymobService(this, "1", new AdEventListener(), false);
4.Load the video advertising
5.Check whether the video advertising is loaded successfully
6.Show video advertising
7.Android display video ads
Display ads before loading, the following style is a well way

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