SDK Ads Android

From wiki.taptica.com
Revision as of 11:35, 22 August 2012 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Steps to Integration

To integrate with TapticaAd™ SDK, follow these steps: 1. Application/Site ID - Retrieve your app/site ID from Taptica's account manager. 2. Download SDK - Download the TapticaAd™ SDK from the Taptica developer's website 3. Premissions Declaration - Provide our application with the relevant permissions 4. Import - import the .jar file to your application 5.Call SDK - Use TapticaAd™'s SDK in order to receive real ads from the server.


Application/Site ID TapticaAd™

Retrieve your Application ID from Taptica's account manager or register to the TapticaAd™ service via Taptica's website - [1]. at the end of the process ou will acquire an Application ID . Save it for future use, it will be needed when identifying your application/site while using the TapticaAd™ Android SDK.


Downloading TapticaAd™ SDK

Following download, you can extract the downloaded file and find the .jar file, the minimum requirement for the SDK to run.


Declaring permissions

You must add internet permissions for your application into the manifest file:

 <uses-permission android:name="android.permission.INTERNET" />

it is required in order for the SDK to contact the AdCore™ server. You may also wish to add one of the following permissions, which will enable you to implement geo-location targeting:

 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
 or:
 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

TapticaAd™ SDK supports multiple screen sizes. You can also add the following permissions into the manifest as well:

 <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" />

This enables TapticaAd™ SDK to provide your application with the optimal ad size, based on screen size. TapticaAd™ SDK automatically suports indicating whether the end user is currently using Wi-Fi or Carrier Network. We recommend using this feature. The permission needed for this feature is:

 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


Importing

Import the .jar file, included in the SDK pack, into your application. If you are using the Eclipse development environment: 1. Right click on your project in the project explorer window 2. Select Properties 3. Click Java Build Path. 4. Click the Libraries tab. 5. Click the Add External JARs button 6. Navigate to the location of the TapticaAdSDK.jar and select it. 7. Click OK

To include Javadoc for displaying your information while using the SDK: 1. Expand the newly added entry (TapticaAdSDK.jar) and select Javadoc Location. 2. Select Edit and then Javadoc in archive as an archive path. 3. Select the path to the .jar file and as a Path within archive choose doc. 4. Select 'OK for all the windows and in order to confirm all changes.


Calling the SDK

The first step in using the SDK is to place the ad view into your activity. The profiling clues for the AdCore™ server are set and the requestAd() on the ad view is invoked.

Following are some basic example you may wish to apply:

  package com.TapticaAdSdkTest;
  import android.app.Activity;
  import android.os.Bundle;
  import android.widget.LinearLayout;
  import com.Taptica.AdCore.TapticaAdManager;
  import com.Taptica.AdCore.TapticaAdView;
  import com.Taptica.AdCore.TapticaAdManager.LocationRequestType;
  public class TapticaAdSdkText extends Activity
  {
  @Override
  public void onCreate(Bundle savedInstanceState)
  {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  TapticaAdManager.setApplicationId("my application id");
  // creating and setting a new TapticaAdView :
  final TapticaAdView adView=new TapticaAdView (this);
  // <==here you can put optional clues for the Taptica Ad server
  LinearLayout linearLayout=(LinearLayout)findViewById(R.id.linear_layout);
  linearLayout.addView(adView);
  // request a new ad to be shown
  adView.requestAd();
  // adView.requestFullScreenAd(); // use for full screen ad
  }


“AndroidManifest.xml” file:

  <?xml version="1.0" encoding="utf-8"?>
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.TapticaAdSdkTest" android:versionCode="1" android:versionName="1.0">
  <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="8" />
  <supports-screens android:smallScreens="true"
  android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" />
  <uses-permission android:name="android.permission.INTERNET" />
  <application android:icon="@drawable/icon" android:label="@string/app_name">
  <activity android:name="com.LoigiaAdSdkTest.TapticaAdSdkTest" android:label="@string/app_name">
  <intent-filter>
  <action android:name="android.intent.action.MAIN" />
  <category android:name="android.intent.category.LAUNCHER" />
     </intent-filter>
     </activity>
    </application>
  </manifest>


"main.xml" file:

  <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="fill_parent"
  android:layout_height="fill_parent" android:id="@+id/linear_layout">
  <TextView android:layout_width="fill_parent" android:id="@+id/text_view"
  android:layout_height="wrap_content" android:text="the ad is shown below this line:" />
  </LinearLayout>

For banner ad use: adView.requestAd();

For full screen ad use: adView.requestFullScreenAd();

When requesting banner ad, it will appear& refresh untill removed from super view. It is possible to request full screen ad while banner ad are displaying. When requesting full screen while banner ad displaying the banner ad will be paused and not refreshed.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox