Developer Console

Integrate the Appstore SDK

To learn how to add the Appstore SDK to your project, use this guide.

Add the Appstore SDK to your project

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

Step 1: Configure Appstore SDK with your 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 Console with your developer account.
  2. Go to Apps & Services > My Apps. Then click your app. If you don't already have an app, see Submitting Apps to the Amazon Appstore.
  3. Create a new version of your app. In the area below your app's name, click Upcoming Version.

  4. Go to the Upload Your App File screen.
  5. In the Additional information section, click View public key.
  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.

    The Public Key window showing a public key string. A download icon followed by the link text 'AppstoreAuthenticationKey.pem' is shown.
    PEM file download 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 2 (Recommended): Use Maven Central to add the Appstore SDK to your project

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 Console with your developer account and download the public key for your app.

  2. Go 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. In Android Studio, change to the Project view.

    Project view
    Project view
  4. Expand your app folder and open your app's build.gradle file.

  5. Insert the Amazon Appstore SDK into the dependencies section of your build.gradle file as shown below.

     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.5'
    
     // 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.

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

     allprojects {
         repositories {
             mavenCentral()
         }
         dependencies {
             ...
         }
     }
    
  7. Rebuild your project: Build > Rebuild project.

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

Alternative Step 2: Manually add the Appstore SDK to your project library

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.5, the code would look like this:

    dependencies {
        implementation files('libs/amazon-appstore-sdk-3.0.5.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'])
    }
    

Next steps

You can now use the IAP, DRM, and SSI APIs 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: Dec 04, 2023