Cordova application display banner ads in the relative position
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. Initialization Keymob
Initialization Keymob library management is the prerequisite to call other advertising functions, the following initialization method is to use the Keymob.com service
keymob.initFromKeymobService("1", true);
Parameter Description
- "1" the first parameter is the ID Keymob application, at Keymob.com for creating an application
ID
- "true" "false" Whether testing mode, set to true when debug, set false when released
2.Display advertising
Show banner ads in the relative position location at the center bottom of the app
keymob.showBannerRelation(keymob.AdSize.BANNER,keymob.AdPosition.BOTTOM_CENTER,0);
Parameter Description
- BannerSizes.BANNER first parameter Ad size, all the default support advertising banners size are in
BannerSizes class,
- BannerPositions.BOTTOM_CENTER the second parameter is the relative position of advertising
- " 0" the third parameter is the padding y
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