SDK Ads Android
(Created page with " == 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....") |
|||
Line 123: | Line 123: | ||
It is possible to request full screen ad while banner ad are displaying. | 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. | When requesting full screen while banner ad displaying the banner ad will be paused and not refreshed. | ||
+ | |||
+ | |||
+ | == 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 - [http://taptica.com]. 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. | ||
+ | |||
+ | |||
+ | == Common methods == | ||
+ | The API in the SDK is composed of 2 basic classes: | ||
+ | 1.'''TapticaAdView''' - an ad view that simply shows an ad. This view only shows an ad after you have requested an ad. it is implemented using '''requestAd.''' | ||
+ | |||
+ | 2.'''TapticaAdManager''' - a module class that manages all TapticaAdView class instances and the extra data that can be transferred to the server for each ad request. | ||
+ | |||
+ | The minimal usage of the SDK is shown in the Calling the SDK in the steps to integration. | ||
+ | |||
+ | As a general rule, the following steps must be taken: | ||
+ | 1.'''TapticaAdManager.setApplicationId (YOUR_APPLICATION_ID);''' | ||
+ | |||
+ | where YOUR_APLICATION_ID is a string containing only the application ID provided following your registration with the taptica ad service. | ||
+ | |||
+ | Create a new TapticaAdView instance either by code or by XML. | ||
+ | Call '''requestAd()''' on your created view. | ||
+ | |||
+ | You also have the option to add some clues regarding the target audience before calling '''requestAd()'''. Most of the clues are set using the TapticaAdManager. | ||
+ | |||
+ | The only clues that are set using TapticaAdView are the keywords. Once set, the clues won't need to be reset, except for the keywords of TapticaAdView where new instances are required. | ||
+ | |||
+ | During the debug process, you may wish to enable test mode, which is guaranteed to always return you a (test) ad from the server. This enables you to know how much space the acutal ad would take. | ||
+ | |||
+ | In general, we recommend adding as many clues to the server about the target audience as possible, enabling the most appropriate ads to be formulated according to the provided data. We advise you to familiarize yourself with Javadocs in order to obtain optimal benefit from the service, providing you with the easiest and most relevant ads for your target audience. | ||
+ | |||
+ | Listed on the following pages are some of the most common procedures that you may find helpful. each of them is optional. They all have significance only after you have requested an ad. | ||
+ | |||
+ | |||
+ | == TapticaAdManager Methods == | ||
+ | '''SetAplicationCategory(String applicationCategory)''' - sets the geographic location of the device to be as the specified location. This can be a useful feature in the following scenarios: | ||
+ | *Debugging- When you wish to check that the ads will be delivered based on the location of the device | ||
+ | *Knoledge of the target audience - when you wish to provide ads limited to a specific area. | ||
+ | |||
+ | '''SetTestMode(boolean testMode)''' - can set the next ad requests to be test ads. Such ads will always be returned, but are not real ads and therfore won't provide any profit when clicked. This feature is intended for use during the development process and not for when the application is on the market. | ||
+ | |||
+ | '''setUserAreaCode (java.lang.String userAreaCode)''' - sets the user's area code. | ||
+ | |||
+ | '''setUserBirthdate (java.util.GregorianCalendar userBirthDate)''' - sets the user's birth date. | ||
+ | |||
+ | '''setUserGender (TapticaAdManager.Gender userGender)''' - sets the user's gender (male/female). | ||
+ | |||
+ | '''setUserPostalCode (java.lang.String userPostalCode)''' – sets the user's zip code. | ||
+ | |||
+ | |||
+ | == TapticaAdView Methods == | ||
+ | |||
+ | '''Cleanup ()''' - cleans all content of the ad view. | ||
+ | |||
+ | '''setKeywords (java.lang.String keywords)''' –sets the keywords to be sent to the server for each ad request. For example, with an application for toddlers, you might consider using “kids children toys” as keywords. |
Latest revision as of 12:44, 22 August 2012
[edit] 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.
[edit] 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.
[edit] Downloading TapticaAd™ SDK
Following download, you can extract the downloaded file and find the .jar file, the minimum requirement for the SDK to run.
[edit] 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" />
[edit] 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.
[edit] 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.
[edit] 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.
[edit] Application/Site ID TapticaAd™
Retrieve your Application ID from Taptica's account manager or register to the TapticaAd™ service via Taptica's website - [2]. 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.
[edit] Downloading TapticaAd™ SDK
Following download, you can extract the downloaded file and find the .jar file, the minimum requirement for the SDK to run.
[edit] 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" />
[edit] 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.
[edit] 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.
[edit] Common methods
The API in the SDK is composed of 2 basic classes: 1.TapticaAdView - an ad view that simply shows an ad. This view only shows an ad after you have requested an ad. it is implemented using requestAd.
2.TapticaAdManager - a module class that manages all TapticaAdView class instances and the extra data that can be transferred to the server for each ad request.
The minimal usage of the SDK is shown in the Calling the SDK in the steps to integration.
As a general rule, the following steps must be taken: 1.TapticaAdManager.setApplicationId (YOUR_APPLICATION_ID);
where YOUR_APLICATION_ID is a string containing only the application ID provided following your registration with the taptica ad service.
Create a new TapticaAdView instance either by code or by XML. Call requestAd() on your created view.
You also have the option to add some clues regarding the target audience before calling requestAd(). Most of the clues are set using the TapticaAdManager.
The only clues that are set using TapticaAdView are the keywords. Once set, the clues won't need to be reset, except for the keywords of TapticaAdView where new instances are required.
During the debug process, you may wish to enable test mode, which is guaranteed to always return you a (test) ad from the server. This enables you to know how much space the acutal ad would take.
In general, we recommend adding as many clues to the server about the target audience as possible, enabling the most appropriate ads to be formulated according to the provided data. We advise you to familiarize yourself with Javadocs in order to obtain optimal benefit from the service, providing you with the easiest and most relevant ads for your target audience.
Listed on the following pages are some of the most common procedures that you may find helpful. each of them is optional. They all have significance only after you have requested an ad.
[edit] TapticaAdManager Methods
SetAplicationCategory(String applicationCategory) - sets the geographic location of the device to be as the specified location. This can be a useful feature in the following scenarios:
- Debugging- When you wish to check that the ads will be delivered based on the location of the device
- Knoledge of the target audience - when you wish to provide ads limited to a specific area.
SetTestMode(boolean testMode) - can set the next ad requests to be test ads. Such ads will always be returned, but are not real ads and therfore won't provide any profit when clicked. This feature is intended for use during the development process and not for when the application is on the market.
setUserAreaCode (java.lang.String userAreaCode) - sets the user's area code.
setUserBirthdate (java.util.GregorianCalendar userBirthDate) - sets the user's birth date.
setUserGender (TapticaAdManager.Gender userGender) - sets the user's gender (male/female).
setUserPostalCode (java.lang.String userPostalCode) – sets the user's zip code.
[edit] TapticaAdView Methods
Cleanup () - cleans all content of the ad view.
setKeywords (java.lang.String keywords) –sets the keywords to be sent to the server for each ad request. For example, with an application for toddlers, you might consider using “kids children toys” as keywords.