B4A Library AmazonDeviceMessaging (ADM)

Amazon Device Messaging (ADM) lets you send messages to Amazon devices that run your app, so you can keep users up to date and involved. Whether you're giving a user a game update or letting them know that a message from their buddy has arrived, ADM helps you stay in touch.
Thank you @cooperlegend for motivating me (🤑) :cool:

Note that ADM is not supported on Kindle Fire (1st Generation) devices.

To start you need to Create your app in Amazon App console.

After you got the credentials and your apptoken you need to place the apptoken in the file api_key.txt inside the project Assets (Files folder).

Similar to FirebaseMessaging this Library depends on a similar setup. You need to have a Service named AmazonMessaging.
See the Example project on how the code may look for. Even the starter is adapted in this Example.

Also note the needed Manifestchanges:
CreateResourceFromFile(Macro, ADM.ADM)
CreateResource(values, strings.xml,
    <string name="app_name">ADMMessenger</string>
    <string name="menu_settings">Settings</string>
    <string name="title_activity_main">MainActivity</string>
    <string name="json_data_msg_key">message</string>
    <string name="json_data_time_key">timeStamp</string>
    <string name="json_data_consolidation_key">collapse_key</string>
    <string name="intent_msg_action">com.amazon.sample.admmessenger.ON_MESSAGE</string>
    <string name="intent_msg_category">com.amazon.sample.admmessenger.MSG_CATEGORY</string>
    <string name="server_address">http://webhook.basic4android.de/</string>
    <string name="server_port">80</string>


Add the following line to your Main
#DebuggerForceStandardAssets: true
It forces the IDE to organize the Assets in a way ADM expects.

A B4J Project for the Sender-Part is also provided. You need to have your Apps Client-Id and Secret to send a Notification.

Author: DonManfred
Version: 0.1
  • ADM
    • Functions:
      • checkManifestAuthoredProperly
      • Initialize (EventName As String)
      • IsInitialized As Boolean
      • startRegister
      • startUnRegister
    • Properties:
      • IS_ADM_AVAILABLE As Boolean [read only]
      • IS_ADM_V2 As Boolean [read only]
      • isClassAvailable As Boolean [read only]
      • RegistrationId As String [read only]
      • Supported As Boolean [read only]
  • AmazonMessaging
    • Events:
      • MessageArrived (MessageJSON As String)
    • Functions:
      • HandleIntent (Intent As android.content.Intent) As Boolean
        Should be called from Service_Start. Returns true if the intent was
      • Initialize (EventName As String)
      • wrap (o As Object) As Object

For any Question you have:
- Please create a new Thread in the B4A Questions Forum.
- Prefix your threadtitle with [ADM].


  • ADMSenderExB4J.zip
    1.9 KB · Views: 185
  • ADMEx.zip
    10.5 KB · Views: 186
  • ADMV0.1.zip
    19.5 KB · Views: 191
Last edited:


Licensed User
Longtime User
Q: What is ADM?
Amazon Device Messaging (ADM) is a push-messaging solution that lets you send messages to Amazon devices running your app. Your server software originates a message and sends it to ADM, and ADM delivers it to a specified instance of your app.

Q: Is ADM free for developers?
ADM is currently available at no cost to developers.

Q: How do users see messages that I've sent?
What your app does with the messages is up to you. ADM is simply a transport mechanism, optimized to queue your messages and deliver them to a targeted instance of your app, even if your app isn't running. For example, upon receiving a message, your app could send this message to the notification tray, display a custom user interface, or perform some other function specific to your needs.

Q: On which Amazon devices is ADM supported?
ADM is supported on Fire phone, Fire TV, and Fire tablets, except for Kindle Fire (1st Generation). For ADM notifications to appear on Fire TV, you must implement the Fire TV Notifications.

Q: In which countries or regions is ADM available?
ADM is available internationally anywhere Fire tablets are sold. If a customer takes their Fire tablet to a location where the device is not sold, they still receive messages sent via ADM.

Q: How quickly are messages delivered?
Speed of message delivery is an ADM priority. The ADM architecture is optimized to deliver billions of messages from developers quickly to devices. Due to varying network conditions, however, the exact timing of message delivery cannot be guaranteed.

Q: Are my messages guaranteed to be delivered?
ADM stores all queue and message information in Amazon's network of highly reliable, highly available data centers. All messages are stored redundantly on multiple servers and in multiple data centers, which means that no single computer or network failure renders ADM messages inaccessible. However, ADM makes no guarantees about delivery or order of receipt for messages.

Q: Are there usage quotas or limits on ADM?
There are two types of limits to your use of ADM:
  • Message size. Your message can be no greater than 6KB in size.
  • Message throttling. To ensure high availability, ADM limits the number of messages that can be sent over a given period of time. If you have specific capacity requirements, please contact us and provide the following information with your request:
    • Your name
    • Company name
    • Your email address
    • Requested TPS (transactions per second) limit
    • Reason
Q: How secure is ADM?
As a sender, your servers are verified via the OAuth 2.0 client credentials flow. As your message is passed to your app on a device, the endpoint connections are authenticated and protected with industry-standard SSL encryption. On the device, ADM uses Android permissions to direct the message to your app only.

Q: How do I get started with ADM?
Overview of ADM provides a quick overview of how to work with ADM in your app and app servers. There is both a server-side component and a client-side component to using ADM.