Amazon SDK Setup

Instructions for adding the OneSignal SDK to your Amazon app

Follow these instructions if your app is distributed on the Amazon AppStore.

Step 1. Requirements

Android Studio is the most common way to build Amazon projects. Follow our Android SDK Setup and return to back to this guide once completed.

Step 2. Update AndroidManifest.xml

2.1. Open your AndroidManifest.xml file and add xmlns:amazon="http://schemas.amazon.com/apk/res/android" in the manifest tag right after the xmlns:android property.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:amazon="http://schemas.amazon.com/apk/res/android"
    package="com.onesignal.example"
    android:versionCode="1"
    android:versionName="1.0" >

2.2. Add the following permissions to AndroidManifest.xml:

<uses-permission android:name="com.amazon.device.messaging.permission.RECEIVE" />
<permission android:name="COM.YOUR.PACKAGE_NAME.permission.RECEIVE_ADM_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="COM.YOUR.PACKAGE_NAME.permission.RECEIVE_ADM_MESSAGE" />

2.3. In the application tag, add the following:

<application ....>
  <amazon:enable-feature android:name="com.amazon.device.messaging"
                         android:required="false"/>
  <service android:name="com.onesignal.ADMMessageHandler"
           android:exported="false" />
  <service android:name="com.onesignal.ADMMessageHandlerJob"
           android:permission="android.permission.BIND_JOB_SERVICE"
           android:exported="false" />
  <receiver android:name="com.onesignal.ADMMessageHandler$Receiver"
            android:permission="com.amazon.device.messaging.permission.SEND" 
            android:exported="true" >
    <intent-filter>
      <action android:name="com.amazon.device.messaging.intent.REGISTRATION" />
      <action android:name="com.amazon.device.messaging.intent.RECEIVE" />
      <category android:name="COM.YOUR.PACKAGE_NAME" />
    </intent-filter>
  </receiver>
  
</application>

2.4. Replace all 3 of instances COM.YOUR.PACKAGE_NAME with your package name in AndroidManifest.xml.

Step 3. Amazon API Key File

3.1 Place your api_key.txt in a folder named assets in the root of your project.

To create an api_key.txt for your app, follow our Generate an Amazon API Key guide.

3.2 Make sure to use the same keystore when building your APK as you did in step 2.4 in the Amazon Configuration guide.

3.3 Ensure that you are not building a debug app when testing Amazon push notifications. It must be a release type.

3.4 Submit the signed APK to Live App Testing. Submitting a signed APK is a necessary requirement for ADM to work.


Troubleshooting

If you run into any issues, please see our Android troubleshooting guide, or our general Troubleshooting section.


Testing

Normal Android devices do not support Amazon's ADM messaging, so you must test on an Amazon device. (First Generation Kindle Fire does not support push).