Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IAmazonDeviceMessagingServerAsync

interface IAmazonDeviceMessagingServerAsync
Extends com.amazon.apmf.IStandard Interface for AmazonDeviceMessaging server.

Methods

registerAsync()

IRegistrationIdPromise* registerAsync()
Register the client app with the ADM cloud, allowing the app to receive ADM messages. When invoked for an app with an existing registrationId or while another registerAsync request is in progress, Promise.getValue will return a cached/same registrationId, provided application metadata hasn’t changed. Requires com.amazon.device-messaging.privilege.access privilege

Returns

IRegistrationIdPromise* Promise from which the app’s registration ID can be retrieved.

Throws

  • SecurityError — if the client app does not declare the required privilege

unregisterAsync()

IRegistrationIdPromise* unregisterAsync()
Unregister the client app from the ADM cloud. The app will no longer receive ADM messages. When invoked for an app with no active registrationId (previously unregistered or yet to be registered) Promise.getValue will return a null. Requires com.amazon.device-messaging.privilege.access privilege

Returns

IRegistrationIdPromise* A Promise from which the previous (now unregistered) registration ID can be retrieved.

Throws

  • SecurityError — if the client app does not declare the required privilege

subscribeToTopicAsync()

ITopicSubscriptionPromise* subscribeToTopicAsync(string topic)
Subscribe the client app to a topic for topic-based messaging. The app will receive ADM messages sent to this topic. Requires com.amazon.device-messaging.privilege.access privilege

Parameters

topic
string — Required The topic to subscribe to.

Returns

ITopicSubscriptionPromise* A Promise indicating the success or failure of the subscription request. There is no value returned through the Promise.

Throws

  • InvalidArgumentError — If topic name doesn’t follow the pattern [a-zA-Z0-9-_.~%]{1,100}
  • SecurityError — if the client app does not declare the required privilege

unsubscribeFromTopicAsync()

ITopicSubscriptionPromise* unsubscribeFromTopicAsync(string topic)
Unsubscribe the client app from a topic for topic-based messaging. The app will stop receiving ADM messages sent to this topic. Requires com.amazon.device-messaging.privilege.access privilege

Parameters

topic
string — Required The topic to unsubscribe from.

Returns

ITopicSubscriptionPromise* A Promise indicating the success or failure of the unsubscription request. There is no value returned through the Promise.

Throws

  • InvalidArgumentError — If topic name doesn’t follow the pattern [a-zA-Z0-9-_.~%]{1,100}
  • SecurityError — if the client app does not declare the required privilege

registerHandler()

void registerHandler(IAmazonDeviceMessagingHandlerAsync* handler)
Register a message handler with the AmazonDeviceMessagingServer. This handler will be invoked to handle incoming ADM messages.

Parameters

handler
IAmazonDeviceMessagingHandlerAsync* — Required The client app’s message handler.

Throws


waitForMessageHandlerCompletionAsync()

IHandlerCompletionPromise* waitForMessageHandlerCompletionAsync(com.amazon.apmf.MonotonicDuration waitDuration)
Wait for the registered MessageHandler to finish handling a message.

Parameters

waitDuration
com.amazon.apmf.MonotonicDuration — Required Maximum time to wait, as a duration in seconds and nanoseconds.

Returns

IHandlerCompletionPromise* An IHandlerCompletionPromise indicating the status of the message handler. There is no value returned through the promise.

Throws


Last modified on October 29, 2026