Amazon Fire Devices

On Amazon Fire devices, Amazon Device Messaging (ADM) is required to send push notifications. If you are shipping on Amazon devices, there are a few extra steps required to support ADM.

In order to use push notifications on Amazon devices, these steps are required.

Follow Amazon’s Set Up Documentation

Amazon’s documentation for ADM is not authored with Unity in mind, so we have supplemented their integration steps with Unity instructions.

The Teak SDK will also automatically try to debug problems with ADM at runtime (in development builds).

Don’t hesitate to contact us if you are confused by any of these steps.

Credentials and API Key

On Amazon you will need an account on the Amazon Developer Console with access to your game.

Follow these instructions to get the credentials for sending push notifications on Amazon devices Finding your Amazon Device Messaging Credentials.

Check Your AndroidManifest.xml

Teak uses the manifest merger stage to automatically add the required changes to your AndroidManifest.xml.

If you are having issues, please check to make sure that the following exist in the final manifest for your game:

    <permission
        android:name="${applicationId}.permission.RECEIVE_ADM_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission android:name="${applicationId}.permission.RECEIVE_ADM_MESSAGE" />
    <uses-permission android:name="com.amazon.device.messaging.permission.RECEIVE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <amazon:enable-feature
        android:name="com.amazon.device.messaging"
        android:required="false"/>

    <service android:name="io.teak.sdk.push.ADMPushProvider$ADMMessageHandler_1_0_1"
        android:exported="false" />

    <service
        android:name="io.teak.sdk.push.ADMPushProvider$ADMMessageHandler_1_1_0"
        android:permission="android.permission.BIND_JOB_SERVICE"
        android:exported="false" />

    <receiver
        android:name="io.teak.sdk.push.ADMPushProvider$MessageAlertReceiver"
        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="${applicationId}" />
        </intent-filter>
    </receiver>

Store Your API Key as an Asset

When this documentation references the assets folder, it means Assets/Plugins/Android/teak-values.androidlib/assets.

Give it a Try

You should now have what you need to test ADM support.

Look at the Android debug logs when you run the build, and look for errors.
If you see
Add this to your <application> in AndroidManifest.xml in order to use ADM: <amazon:enable-feature android:name="com.amazon.device.messaging" android:required="false" />

If you see log output with event_type of amazon.adm.registration_error Teak is trying to determine why ADM registration has failed.

If you see
Unable to find 'api_key.txt' in assets [...]

api_key.txt is not in the Android assets.

If you see
Whitespace found in 'api_key.txt'

There is whitespace somewhere in the contents of api_key.txt, this will prevent Amazon’s SDK from reading the key. Remove the whitespace, it is usually a trailing newline.

If you see
Potentially malformed contents of 'api_key.txt', does not contain three sections delimited by '.'

The contents of api_key.txt are incorrect.

If you see
Package name mismatch in 'api_key.txt'

The package name of your app does not match the package name inside api_key.txt. The api_key.txt must be generated for the package name of your app.

If you see
App signature SHA-256 does not match api_key.txt
App signature MD5 does not match api_key.txt

The signature your app was signed with does not match any of the signatures in api_key.txt.