KomliMobile Android SDK Overview Komlimobile Ad banner use a small portion of the screen to entice users to "click through" to a richer, full-screen experience such as a website or app store page. To display banners in your Android app, simply incorporate the SDK into your Eclipse project and add a com.komlibile.sdk.komlimobileview to your UI. Requirements 1. Make sure you have the latest copy of the Android SDK and that you're compiling against at least Android v3.2 (set target in default.properties to android-13). 2. The KomliMobile SDK for android requires a run-time of Android 1.5 or later (set android:minsdkversion to at least 3 in your AndroidManifest.xml). This means you can develop with the latest version of the Android SDK and your app will still run on an earlier Android version (1.5 minimum). Incorporating the SDK Incorporating KomliMobile Ads into your app is a three step process: 1. Add the SDK JAR to your Eclipse project. 2. Declare com. komlimobile.sdk. KomliMobileActivity in AndroidManifest.xml. 3. Set up required network permissions in the manifest.
Adding the SDK JAR 1. Right click on your app project in Eclipse and choose Properties. 2. Select Java Build Path and the Libraries tab. Then click Add External JARs... to add the Komlimobile Ads JAR.
com.komlimobile.sdk.komlimobileactivity The Komlimobile Ads SDK requires that com.komlimobile.sdk.komlimobileactivity be declared in your app's AndroidManifest.xml: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.company" android:versioncode="1" android:versionname="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <activity android:label="@string/app_name" android:name=".komlimobileandroidsdksample"> <intent-filter> <action android:name="android.intent.action.main"/> <category android:name="android.intent.category.launcher"/> </intent-filter> </activity> <activity android:name="com.komlimobile.sdk.komlimobileactivity" android:configchanges="keyboard keyboardhidden orientation screenlayout uimode scre ensize smallestscreensize"/> <meta-data android:name="client_id" android:value="my_ad_unit_id" /> </application> </manifest> You must replace MY_AD_UNIT_ID with your Komlimobile site id. Permissions Making ad requests requires the networking permissions INTERNET and ACCESS_NETWORK_STATE, ACCESS_WIFI_STATE, READ_PHONE_STATE, CALL_PHONE, so these must also be declared in the manifest: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.company" android:versioncode="1" android:versionname="1.0"> <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"/> <uses-permission android:name="android.permission.call_phone"/> </manifest>
Defining a com.komlimobile.sdk.komlimobileview The easiest way to incorporate an ad is to simply define your KomliMobileView as you would any other part of your res/layout/main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android:background="#ffffff" android:textcolor="#000000" android:layout_height="fill_parent" android:orientation="vertical" android:layout_width="fill_parent"> <com.komlimobile.sdk.komlimobileview xmlns:komlimobile="http://schemas.android.com/apk/res/ com.company" android:layout_width="fill_parent" android:layout_height="52dip" android:layout_gravity="bottom" komlimobile:textcolor="#000000" komlimobile:mode="live" komlimobile:textsize="8" komlimobile:adrefresh="20" komlimobile:adtype="text+picture" komlimobile:adsize="a" komlimobile:rmasupport="a"/> </LinearLayout> textcolor, the color your text ad s text should have. Eg: #FFFFFF. mode, the mode in which your SDK will run, set it to test while developing your app. Ensure that you set the mode to live when distributing the app to your user. textsize, the size of your text ads s test. adrefresh, the time after which a new ad will be loaded. The default auto refresh interval is 10 seconds. adtype, the type of ad (text/ picture / text+picture) adsize, request for specific banner / creative sizes. (A / T / S / M / L / XL / XXL). A ALL (default), T text only, S small ( 120 x 20 ), M medium ( 168 x 28 ), L large ( 216 x 36 ), XL ( 300 x 50 ), XXL (320 x 48 / 320 x 52 ). rmasupport, specify the support for Rich Media Ad. (A / NA). A available, NA not available. Default is NA Setting the Test Mode When developing your app, set the Mode to test. In test mode you will receive all kinds of test ad. komlimobile:mode="test" Note: Ensure that you set the Mode to live when distributing the app to users. By default, Mode is set to live
The attrs.xml in the res/values folder. Add a resource file attrs.xml to the res/values folder of your android project and copy the following code: <resources> <declare-styleable name = "com.komlimobile.sdk.komlimobileview"> <attr name="mode" format="string" /> <attr name="textsize" format="integer" /> <attr name="textcolor" format="color" /> <attr name="adrefresh" format="integer" /> <attr name="adtype" format="string" /> <attr name="adsize" format="string" /> <attr name="rmasupport" format="string" /> </declare-styleable> </resources> For any questions /clarifications contact support@komlimobile.com