public abstract class ADMMessageHandlerJobBase
extends java.lang.Object
ADMMessageReceiver. For an example of using this class,
see Integrating Your App with ADM.
All methods on this class are called on JobScheduler's(background) thread. It is not safe to do long-running operations in these methods as they can be stopped at any time and will be subject to background execution restrictions on android API 26 and above
| Modifier | Constructor and Description |
|---|---|
protected |
ADMMessageHandlerJobBase() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
onMessage(android.content.Context context,
android.content.Intent intent)
Called each time ADM delivers a message to an instance of your app.
|
protected abstract void |
onRegistered(android.content.Context context,
java.lang.String registrationId)
Called when a registration request succeeds.
|
protected abstract void |
onRegistrationError(android.content.Context context,
java.lang.String errorId)
Called when a registration request fails.
|
protected void |
onSubscribe(android.content.Context context,
java.lang.String topic)
Called on successful subscription to a topic.
|
protected void |
onSubscribeError(android.content.Context context,
java.lang.String topic,
java.lang.String errorId)
Called when a subscription request fails.
|
protected abstract void |
onUnregistered(android.content.Context context,
java.lang.String registrationId)
Called on successful unregistration.
|
protected void |
onUnsubscribe(android.content.Context context,
java.lang.String topic)
Called on successful unsubscription from a topic.
|
protected void |
onUnsubscribeError(android.content.Context context,
java.lang.String topic,
java.lang.String errorId)
Called when a unsubscription request fails.
|
protected ADMMessageHandlerJobBase()
protected abstract void onMessage(android.content.Context context,
android.content.Intent intent)
context - A context to your applicationintent - An intent containing the message and associated data.
You extract the message content from the set of extras attached to the
com.amazon.device.messaging.intent.RECEIVE intent. For an example of defining
the behavior of the onMessage() callback, see
SampleADMMessageHandler.java in the ADMMessenger sample app.protected abstract void onRegistrationError(android.content.Context context,
java.lang.String errorId)
context - A context to your applicationerrorId - one of the following values:
protected abstract void onRegistered(android.content.Context context,
java.lang.String registrationId)
ADM.startRegister() or if ADM has updated
the registration ID for this app instance.context - A context to your applicationregistrationId - The new registration ID for the instance of your app. Pass this
value to your components that are using ADM to send messages. The
ADM.getRegistrationId() method also
obtains the registration ID for an instance of your app.protected abstract void onUnregistered(android.content.Context context,
java.lang.String registrationId)
ADM.startUnregister() or if ADM has unregistered the
app for some reason (typically because the device has lost its association with a user's
Amazon account). If this message is called, your app should notify your components
that are using ADM to send messages, so that they know this instance of your app is no longer
a valid recipient.context - A context to your applicationregistrationId - The registration ID for the instance of your app that is now unregistered.
This ID is no longer a valid destination for messages.
Calling ADM.getRegistrationId()
will show the registration ID for an unregistered app as null.protected void onSubscribe(android.content.Context context,
java.lang.String topic)
ADM.subscribeToTopic(String) Topic()}context - A context to your applicationtopic - topic the app is subscribed toprotected void onSubscribeError(android.content.Context context,
java.lang.String topic,
java.lang.String errorId)
context - A context to your applicationtopic - topic the app was trying to subscribeerrorId - one of the following values:protected void onUnsubscribe(android.content.Context context,
java.lang.String topic)
ADM.unsubscribeFromTopic(String) Topic()}context - A context to your applicationtopic - topic the app is unsubscribed fromprotected void onUnsubscribeError(android.content.Context context,
java.lang.String topic,
java.lang.String errorId)
context - A context to your applicationtopic - topic the app was trying to unsubscribeerrorId - one of the following values: