Developer Console
Vielen Dank für deinen Besuch. Diese Seite ist nur in Englisch verfügbar.

Integrate the Appstore SDK

The Appstore SDK provides functionality for handling Digital Rights Management (DRM) and In-App Purchasing (IAP) within your Java Android apps. The Appstore SDK supports apps targeting Fire TV, Fire tablets, and third-party devices where Amazon apps can be installed.

Functionality Provided through the Appstore SDK

The following table lists the current functionality provided by the Appstore SDK.

Functionality Description
Digital Rights Management (DRM) DRM, or more generally "license verification," is used to address developer concerns around unauthorized copying and distribution of apps. DRM is mostly used for paid apps. If your app has Amazon DRM applied to it, users must install the Amazon Appstore client (built-in to Fire devices) and they must be signed-in to access your app. The DRM methods you integrate into your app checks with the Amazon Appstore device service to see whether the user has a valid license for your app. If the user does not sign in or does not have a valid license, the app does not run. However, any user can gain a license by purchasing the app through Amazon. See Enforce DRM in Your App for more information. You can also explore the DRM Sample App.
In-App Purchasing (IAP) With In-App Purchasing (IAP), users can purchase digital items within your app, such as extra lives for a game, in-app items for users to enhance their gaming experience (currency, extra moves, lives, bonus levels, mini-games, and so on). Or your app might offer a premium subscription with access to special content. IAP handles details about purchase flow, payment processing, app receipts, and rights management so that you do not have to code this purchasing infrastructure in your app. See In-App Purchasing Overview for more information.

Minimum Device Requirements to Support Appstore SDK

The Appstore SDK requires devices to have at least Android API Level 14 or higher.

Download the Appstore SDK

Download the Amazon Appstore SDK from the SDK Downloads page.

Transitioning to the Appstore SDK

See Transitioning to the Appstore SDK.

Steps to Integrate the Appstore SDK

To integrate the Appstore SDK into your Android project, follow the steps below:

Step A: Configure Appstore SDK with Public Key

This public key, which is unique per app, establishes a secure communication channel between the Amazon Appstore and your app. When you generate the public key from the developer console, Amazon generates a corresponding private key. These public and private keys form a key pair to sign license responses. Through this key pairing, you ensure that the users who install your app are authorized.

To configure your existing app with the public key:

  1. Log into the Developer Portal with your developer account.
  2. Go to Apps & Services > My Apps. Then click your app. (If you don't already have an app, see Log In and Add an App.)
  3. Create a new version of your app. In the area below your app's name, click Upcoming Version.

  4. Go to the APK Files tab.
  5. Click Public Key in the upper-right area.
  6. In the Public Key dialog box that appears, click the AppstoreAuthenticationKey.pem link to download a PEM file. This file contains your public key.

    PEM file link
    PEM file link
  7. Copy the AppstoreAuthenticationKey.pem file. Then paste it into the app/src/main/assets folder of your Android Studio project.

    In the Project view, the assets folder is usually in app/src/main/assets. If your app doesn't have an assets folder, you must create one. Then drag your PEM file into it.

Step B: Add the SDK Library to Your Project

Add the amazon-appstore-sdk-[x].jar into your Android project:

  1. In Android Studio, change to the Project view.

    Project view
    Project view
  2. Expand your app folder and select libs. (If you don't have a libs folder, create one). Paste the amazon-appstore-sdk-[x].jar file into this directory.

  3. Open your app's build.gradle file and add a dependency on the amazon-appstore-sdk-[x].jar. For example, if the JAR was version 3.0.2, the code would look like this:

    dependencies {
        implementation files('libs/amazon-appstore-sdk-3.0.2.jar')
    }
    

    Customize the name above based on the amazon-appstore-sdk-[x].jar version you use.

    If you have multiple dependencies, instead of referring to a specific JAR, you can reference all JARs more generally like this:

    dependencies {
        ...
        api fileTree(dir: 'libs', include: ['*.jar'])
    }
    

If you follow the above procedure, you don't need to read the next section.

Alternative Step B (Recommended): Use Maven Central

Integrating and updating the Amazon Appstore SDK in Android Studio is easier with the Amazon SDK release on Maven Central. Maven Central is a repository of build-artifacts. You can integrate those artifacts directly within Android Studio and the Gradle open source build automation system. If you develop your app using Android Studio and Gradle, you can integrate the Amazon Appstore SDK by setting up your app's build.gradle file. In this way your project will always use the latest version of the SDK.

Follow these instructions:

  1. If you haven't done so, log into the Developer Portal with your developer account and download the public key for your app.

  2. Back to your Android Studio project, if you already have an older version of the Amazon Appstore SDK in your code, remove the old SDK.

  3. Insert the Amazon Appstore SDK into the dependencies section: add the single line of code at the end of the code snippet below into your app’s build.gradle file to download and integrate the Amazon Appstore SDK.

     dependencies {
         ...
         implementation 'com.amazon.device:amazon-appstore-sdk:3.+'
     }
    

    Note: The example above shows you how to get the latest Amazon Appstore SDK with major version 3. You can also define specific versions and/or wildcards. Using wildcards is not a suitable option for a live project because of unforeseen stability issues. However, using wildcards in your version declaration can be useful while debugging or testing your project against the latest version of the Amazon Appstore SDK. Replace any segment of the version number with a + to use the latest iteration:

     // Pull and compile the specific release of the Amazon Appstore SDK
     implementation 'com.amazon.device:amazon-appstore-sdk:3.0.2'
    
     // Pull and compile the latest 3.x release of the Amazon Appstore SDK
     implementation 'com.amazon.device:amazon-appstore-sdk:3.+'
    
     // Pull and compile the latest release of the Amazon Appstore SDK
     implementation 'com.amazon.device:amazon-appstore-sdk:+'
    

    The next time you build your app, this method imports all the necessary files into your project.

  4. Make sure your project’s top-level build.gradle has the Maven Central repository defined, or add it otherwise:

     allprojects {
         repositories {
             mavenCentral()
         }
         dependencies {
             ...
         }
     }
    

Next Steps

You can now use the DRM API and IAP to leverage the needed functionality in your app. See these topics for more information:

FAQ

See the FAQ sections in these topics for more details:


Last updated: Oct 18, 2021