Android Applicationa Display Ads Tutorial

Obtain Android ads management library

To show ads on mobile application which reqired add advertisement management library in the application,20150801 is the current version of keymob ads management.you will see the android project structure in the file you downloaded, most of which is common android project files and directories, the following resources are Keymob related . Download the advertising management library

notice:folders name of those 3 documents can't been modify

com_keymob_sdks contails file AdmobAdapter.jar used by keymob lib when unable to connect to Keymob.com . If you want to change to other platform You can download more.  In addition to the above to download resources, using keymob official support platform, need not to add the platform code alone

Add management library to eclipse project

Using advertising management library need the following a few steps
  1. Copy the downloaed keymobad. jar to your android project under the libs
  2. Copy the com_keymob_sdks downloaded to your android project assets
  3. If you want to use baidu advertising platform, copy the biduad_plugin downloaded to your android project assets
  4. If you want to use gdt platform, copy the gdt_plugin downloaded to your android project assets

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. 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
AdManager.getInstance().initFromKeymobService(this, "1", new AdEventListener(), false);
3. Display advertising
Show the banner ads in the absolute position (0,200)
AdManager.getInstance().showBannerABS(BannerSizes.BANNER, 0, 200);
4.Add AD permissions
Edit AndroidManifest. XML to add the necessary permissions reqired by advertising platform
<!-- base permission -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!-- base permission for location-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- base permission required by chartboost and baidu-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- permission required by mmedia -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.microphone" android:required="false" />
5.Add the advertising Activity configuration information
Edit AndroidManifest.xml add ad platform of Activity, app will not be able to display advertising platform if not add platform Activity

<meta-data android:name="com.google.android.gms.version" android:value="7327000" /> <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent"/>
<!-- Amazon Mobile Ads --> <activity android:name="com.amazon.device.ads.AdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>

<!-- InMobi --> <activity android:name="com.inmobi.androidsdk.IMBrowserActivity" android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:hardwareAccelerated="true" />

<!-- Millennial Media --> <activity android:name="com.millennialmedia.android.MMActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation|keyboard|screenSize" ></activity>

<!-- Keymob --> <activity android:name="com.keymob.sdk.core.KeymobActivity" android:theme="@android:style/Theme.Dialog" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<!-- baidu --> <activity android:name="com.baidu.mobads.AppActivity" android:configChanges="keyboard|keyboardHidden|orientation"/>

<!-- adcolony --> <activity android:name="com.jirbo.adcolony.AdColonyOverlay" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" /> <activity android:name="com.jirbo.adcolony.AdColonyFullscreen" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" /> <activity android:name="com.jirbo.adcolony.AdColonyBrowser" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />

<!-- guang dian tong --> <service android:name="com.qq.e.comm.DownloadService" android:exported="false"/> <activity android:name="com.qq.e.ads.ADActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize"/>

More tutorial of add ad in app   qq group 310513042   home