APS - Android SDK Init

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

3/7/22, 10:48 AM APS - Android SDK

Show Hidden Features


 Back to Admin

temp  

DOCUMENTS
Amazon Publisher Services (APS) Android SDK
Getting Started

MoPub Deprecation Android SDK Sample App


Ad Ops

Google Ad Manager
Android SDK initialization
Google AdMob This documentation will outline how to import the APS SDK and set your app id. Please ensure you have completed the first three steps outlined in the
Introduction before importing the SDK. The Android SDK is available to download and import into your Android Studio project via manual integration.
ironSource
The APS Android SDK requires the following:
MAX
Android 4.4 (KitKat API 19) or later
Android SDK
If your SDK supports API versions lower than 19, please see required changes to your manifest file in Step 2.
Google Ad Manager
Android Studio or Eclipse installed with the Android Development Tools (ADT) Plugin
Google AdMob
Java 8 or later
ironSource
AndroidX migration

MAX Please refer to the Android documentation to migrate your project to AndroidX.

Other Ad Server

Custom Mediation Step 1. Import APS SDK


Release Notes MavenCentral (recommended)
iOS SDK Open your build.gradle file and add the following:

Google Ad Manager
repositories {

Google AdMob
mavenCentral()

ironSource }

MAX
dependencies {

Other Ad Server implementation ("com.amazon.android:aps-sdk:9.4.1")

}
Custom Mediation

Release Notes If you are using AdMob, include another dependency.

Unity
repositories {

Google AdMob mavenCentral()

}
Release Notes

Integration Verification
dependencies {

App-ads.txt implementation ("com.amazon.android:aps-sdk:9.4.1")

implementation ("com.amazon.android:aps-admob-adapter:2.0.3")

GDPR }

CCPA
If you are using ironSource, include another dependency.
FAQs

APS Reporting repositories {

mavenCentral()

S3 Reporting maven {

url 'https://android-sdk.is.com/'

Amazon Publisher Services


}

Agreement
}

dependencies {

implementation ("com.amazon.android:aps-sdk:9.4.1")

implementation ("com.ironsource.adapters:apsadapter:4.3.2")

If you are using MAX, include another dependency.

repositories {

mavenCentral()

}
 Help

https://dtb-portal.amazon.com/webpublisher/uam/docs/aps-mobile/android 1/6
3/7/22, 10:48 AM APS - Android SDK

dependencies {

implementation ("com.amazon.android:aps-sdk:9.4.1")

implementation ("com.applovin.mediation:amazon-tam-adapter:9.3.0.3")

Manual integration

1. Extract and unzip the aps-sdk.aar  file from the downloaded SDK package.
2. Add aps-sdk.aar  to your app:
a. On the File menu, click New, and then click New Module.
b. Choose Import .JAR/.AAR Package in the pop-up dialogue, and then click Next.
c. In the new dialogue box, find the aps-sdk.aar location and import it.
d. On the File menu, click Project Structure.
e. Under Modules, click app, and then click the Dependencies tab.
f. Add the .aar file as a dependency.

Google Mobile Ads SDK 

If you are using Google Ad Manager or AdMob, please refer to the following table for the corresponding APS SDK and Google Mobile Ads SDK versions of
your app. If you’re using AdMob, the corresponding adapter version for  aps-admob-adapter.aar is also included below:

Google Mobile Ads Version APS SDK Version APS AdMob Adapter Version

Google v19.8.0 – V20.0.0+ 9.2.0+ 2.0.1+

Google v19.7.0 – V19.8.0 8.4.3 1.5.0

Google v19.4.0 – V19.6.0 8.4.3 1.4.0

ProGuard

If you are using ProGuard, complete the following steps:

1. Add the following configuration to your project’s build.gradle file:

buildTypes {

release {

minifyEnabled true

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

2. Add the following line to your project’s proguard-rules.pro file:

-keep class com.amazon.device.ads.** { *; }

Step 2. Add permissions/activities to Android manifest


The following permissions must be present in your manifest file:
 Help

https://dtb-portal.amazon.com/webpublisher/uam/docs/aps-mobile/android 2/6
3/7/22, 10:48 AM APS - Android SDK

<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" />

If you wish to pass geo location information, please include the following permissions in your manifest file:

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

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

For those integrating with AdMob, ironSource, MAX, and our Custom Mediation solution, please add the following under the <application> section of
your manifest file:

<activity android:name="com.amazon.device.ads.DTBInterstitialActivity"/>

<activity android:name="com.amazon.device.ads.DTBAdActivity"/>

If your minSdkVersion is lower than API 19, please make the following changes:

1. Add the following to your AndroidManifest.xml file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:tools = "http://schemas.android.com/tools"

package="com.pbs.sampledtbapp"/>

<uses-sdk tools:overrideLibrary="com.amazon.device.ads"/>

2. Use the following condition to check the Android version during runtime to invoke APS functionality:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

// APS code here

Step 3. Set your app id/key


During setup, you generated an APS app id. If you have not done so, please complete step 1 within the APS portal. This app id is associated to your app
and allows APS to attribute all applicable impressions. Your app should call the AdRegistration getInstance() method on every app start using the
app id/key:

AdRegistration.getInstance(APP_KEY, this);

//Where 'this' is an activity context.

Ad server/mediator identifier

Please use the setAdNetworkInfo method to pass your primary ad server or mediator. For example, if you’re using MAX, you would call the following:

AdRegistration.setAdNetworkInfo(new DTBAdNetworkInfo(DTBAdNetwork.MAX));

List of possible DTBAdNetwork enums:

GOOGLE_AD_MANAGER

MOPUB_AD_SERVER

ADMOB

AD_GENERATION

IRON_SOURCE

MAX

NIMBUS

OTHER

MRAID

Please pass MRAID info as part of the SDK initialization. Choose one according to your ad server:

// For Google Ad Manager (Google Play Ads Services version 15.0.0 and above)

AdRegistration.setMRAIDSupportedVersions(new String[] {"1.0", "2.0", "3.0"});

AdRegistration.setMRAIDPolicy(MRAIDPolicy.CUSTOM);

// For Google Ad Manager (Google Play Ads Services versions below 15.0.0)

AdRegistration.setMRAIDPolicy(MRAIDPolicy.DFP);

 Help

https://dtb-portal.amazon.com/webpublisher/uam/docs/aps-mobile/android 3/6
3/7/22, 10:48 AM APS - Android SDK

// For others, including iS and MAX

AdRegistration.setMRAIDSupportedVersions(new String[] {"1.0", "2.0", "3.0"});

AdRegistration.setMRAIDPolicy(MRAIDPolicy.CUSTOM);

Geo location tracking

If your app does not collect geo location, the APS SDK will not receive geo location even if useGeoLocation() is enabled. If your app does collect geo
location, your app should call the AdRegistration.useGeoLocation() method:

AdRegistration.useGeoLocation(true);

Logging/testing

To enable SDK logging and test mode, call the below methods. For more information, visit the Integration Verification guide.

AdRegistration.enableLogging(true);

AdRegistration.enableTesting(true);

Do not forget to remove enableTesting() in production as the test ads are not eligible for monetization.

Open Measurement SDK (OM SDK)

If you have the OM SDK integrated, you can pass the OMID Partner info using the addCustomAttribute method. Please see the IAB specification for
more information.

Attribute Type Description Implementation

Identifier of the OM SDK integration.


This is the same as the “name”
parameter of the OMID Partner AdRegistration.addCustomAttribute("omidPartnerName",
omidPartnerName string OMID_PN_VALUE);
object. Select the partner name from
the IAB’s OMSDK compliant table. We
support Google and MoPub.

Version of the OM SDK integration.


This is the same as the AdRegistration.addCustomAttribute("omidPartnerVersion",
omidPartnerVersion string OMID_PV_VALUE);
“versionString” parameter of the
OMID Partner object.

Contextual parameters

Contextual parameters can be passed in using the  addCustomAttribute(String key, String value);  and removed
using  removeCustomAttribute(String key);

We recommend you update and pass this to us before every APS ad request.

Attribute Type Description Implementation

The count of impressions in a given app session. Maintain a global counter


within the app for each session, then update and pass the counter to AdRegistration.addCustomAttribute("impDepth",
impDepth String "20");

AdRegistration.addCustomAttribute(). This will include total impressions


from all of your demand and can be reset once a session ends.

The total duration of time a user has spent thus far in a specific app session,
expressed in seconds. A session can be defined as the following examples: AdRegistration.addCustomAttribute("SessDuration",
sessDuration String when a user logs in/out or when a user dismisses the app to the "20");
background. This can be anything that you define as a session within your
app.

The url of the content you are displaying to users. For example, if you are AdRegistration.addCustomAttribute("ContentURL",
contentURL String displaying content from https://yourdomain.com/section/content, you can "https://www.amazon.com/");
pass this url to us.

APS SDK data collection practices

Does
Amazon
Category Data type Description
SDK
Collect?

User or device physical location to an area greater than or equal to 3 square Only if
Approximate
Location kilometers, such as the city a user is in, or location provided by Android’s publisher
location
ACCESS_COARSE_LOCATION permission. elects

Only if
User or device physical location within an area less than 3 square kilometers,
Precise location publisher
such as location provided by Android’s ACCESS_FINE_LOCATION permission.
elects

Personal
Name How a user refers to themselves, such as their first or last name, or nickname. No
info

Email address A user’s email address. No


 Help

https://dtb-portal.amazon.com/webpublisher/uam/docs/aps-mobile/android 4/6
3/7/22, 10:48 AM APS - Android SDK

Personal Identifiers that relate to an identifiable person. For example, an account ID,
No
identifiers account number, or account name.

Address A user’s address, such as a mailing or home address. No

Phone number A user’s phone number. No

Race and
Information about a user’s race or ethnicity. No
ethnicity

Political or
Information about a user’s political or religious beliefs. No
religious beliefs

Sexual
Information about a user’s sexual orientation. No
orientation

Other personal Any other personal information such as date of birth, gender identity, veteran
No
info status, etc.

Credit card, debit


Financial
card, or bank Information about a user’s financial accounts such as credit card number. No
info
account number

Purchase history Information about purchases or transactions a user has made. No

Information about a user’s credit. For example their credit history or credit
Credit info No
score.

Other financial
Any other financial information. No
info

Health and Health


Information about a user’s health, such as medical records or symptoms. No
fitness information

Fitness
Information about a user’s fitness, such as exercise or other physical activity. No
information

A user’s emails including the email subject line, sender, recipients, and the
Messages Emails No
content of the email.

SMS or MMS A user’s text messages including the sender, recipients, and the content of the
No
messages message.

Other in-app
Any other types of messages. For example, instant messages or chat content. No
messages

Photos or
Photos A user’s photos. No
videos

Videos A user’s videos. No

Voice or sound
Audio files A user’s voice such as a voicemail or a sound recording. No
recordings

Music files A user’s music files. No

Other audio files Any other user-created or user-provided audio files. No

Files and A user’s files or documents, or information about their files or documents
Files and docs No
docs such as file names.

Information from a user’s calendar such as events, event notes, and


Calendar Calendar events No
attendees.

Information about the user’s contacts such as contact names, message history,
Contacts Contacts and social graph information like usernames, contact recency, contact No
frequency, interaction duration and call history.

Page views and Information about how a user interacts with your app. For example, the
App activity No
taps in app number of page views or the screen coordinates of taps.

In-app search
Information about what a user has searched for in your app. No
history

Installed apps Information about the apps installed on a user’s device. No

Other user-
Any other user-generated content not listed here, or in any other section. For
generated No
example, user bios or notes.
content

Any other user activity or actions in-app not listed here such as gameplay and
Other actions No
likes.

Web Web browsing


Information about the websites a user has visited. No
browsing history

App info
Crash log data from your app. For example, the number of times your app has
and Crash logs No
crashed, stack traces, or other information directly related to a crash.
performance

Information about the performance of your app. For example battery life,
Diagnostics No
loading time, latency, framerate, or any technical diagnostics.

Other app
performance Any other app performance data not listed here. Yes
data

Device or Identifiers that relate to an individual device, browser or app. For example, an
Device or other
other
identifiers
IMEI number, MAC address, Widevine Device ID, Firebase installation ID, or Yes  Help
identifiers advertising identifier.

https://dtb-portal.amazon.com/webpublisher/uam/docs/aps-mobile/android 5/6
3/7/22, 10:48 AM APS - Android SDK

FAQs

How does a publisher elect to pass Precise Location or Coarse Location data?

Location data is an optional parameter for the APS SDK. Publishers can elect for the APS SDK to collect Precise Location or Coarse Location data by
utilizing the useGeoLocation() function. Full details are in the APS integration documentation. Publishers may only elect for the APS SDK to collect
this data if applicable user consent has been obtained, per the terms of the APS agreement.

How does Amazon Ads use Precise Location or Coarse Location data?

Location data is an optional parameter for the APS SDK. After obtaining applicable user consent, per the terms of the APS agreement, the publisher may
elect for the APS SDK to collect this data. If collected, Amazon Ads does not use precise geolocation data for advertising purposes. Amazon Ads systems
obfuscate location data by reducing precision, and we only use obfuscated location data for ad targeting. We do not use precise geolocation data to
target ads.
If publishers participate in TAM (Transparent Ad Marketplace) or UAM (Unified Ad Marketplace) and publisher has elected the APS SDK to collect location
data, precise geolocation data is also forwarded to the third-party buyers that the publisher has chosen to work with through the APS integration.

How does Amazon Ads use Device IDs?

Amazon Ads systems use IDFA, Android Advertising ID, and related identifiers for advertising purposes such as serving interest based ads, to determine
reach, maintain opt out status, invalid traffic detection and traffic quality, and for frequency capping.
If publishers participate in TAM or UAM, Device IDs are also forwarded to the third-party buyers that the publisher has chosen to work with through the
APS integration.

Conditions of Use
|
Privacy Notice
Copyright © 2013-2022 A9.com, Inc. or its affiliates. An Amazon company.

 Help

https://dtb-portal.amazon.com/webpublisher/uam/docs/aps-mobile/android 6/6

You might also like