question

newuser-378a102a-3ee7-4c9b-af47-1eb0167dca27 avatar image

ADM onMessage not called until device synced

onRegistered and other methods are called fine.


I am using SNS to publish the ADM message. After I receive and log the registrationId in the onRegistered callback, I manually create the SNS platform endpoint with the registrationId,.

When I publish the message via SNS it shows a 200, however the onMessage callback is not triggered. If, from my fire tablet's settings I click "sync device", I can see my ADM receiver picking up the message and things work as expected. I have run

ADMManifest.checkManifestAuthoredProperly

and it does not return any issues. Given that upon sync everything works together this tells me that my manifest and receiver should be set up correctly.


I can receive ADM messages from other applications on the device, and my application does have an assets folder with the api_key.txt without any spaces.


My manifest looks like so (applicationId defined in a different manifest):

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:amazon="http://schemas.amazon.com/apk/res/android"
    package="com.test.testnotification">

    <!-- This permission ensures that no other application can intercept your ADM messages. -->
    <permission
        android:name="${applicationId}.permission.RECEIVE_ADM_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="${applicationId}.permission.RECEIVE_ADM_MESSAGE" />

    <!-- This permission allows your app access to receive push notifications from ADM. -->
    <uses-permission android:name="com.amazon.device.messaging.permission.RECEIVE" />

    <!-- ADM uses WAKE_LOCK to keep the processor from sleeping when a message is received. -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <application
        android:allowBackup="true">
        <provider
            android:exported="false"
            android:name=".provider.InitProvider"
            android:authorities="com.test.testnotification.provider.InitProvider" />

        <service
            android:name=".service.RegistrationService"
            android:exported="false"/>

        <!-- ADM is required for this library to be used -->
        <amazon:enable-feature
            android:name="com.amazon.device.messaging"
            android:required="true" />

        <!-- Service which handles messages sent by ADM.
        <service
            android:name=".service.NotificationService"
            android:exported="false"/>

        <!-- ADM requires the receiver to be defined in manifest rather than programmatically -->
        <receiver
            android:name=".receiver.NotificationReceiver"
            android:permission="com.amazon.device.messaging.permission.SEND">

            <!-- To interact with ADM, you must listen for the following intents. -->
            <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>
    </application>

</manifest>


I am not sure what needs to be changed to have the broadcast receiver triggered immediately?

amazon device messaging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

HabibRG avatar image
HabibRG answered

hi, i have the same problem, did you find a solution?

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.