Package zendesk.core
Interface ActionHandler
-
public interface ActionHandler
Defines a handler for an inter-SDK action, such as one SDK starting another one, without either SDK having a dependency on the other. An example of this would be a hypothetical Help Center SDK starting the "create ticket" screen of the Support SDK. In order to properly separate SDKs from each other, handlers will work on "action Strings". Similar to Android's Intent system, multiple SDKs can be capable of handling the same action String. For example, a "contact us" action can be handled by Support, Chat, Voice, Message, etc. In the event that more than one ActionHandler has been registered for the same actionString, thegetPriority()
method can be used to determine which one to callhandle
on.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description boolean
canHandle(java.lang.String actionName)
Determines whether or not the ActionHandler object can handle the given action String.int
getPriority()
Returns the priority of the ActionHandler.void
handle(java.util.Map<java.lang.String,java.lang.Object> data, Context context)
Invokes an action on the given action String.
-
-
-
Method Detail
-
canHandle
boolean canHandle(java.lang.String actionName)
Determines whether or not the ActionHandler object can handle the given action String.- Parameters:
actionName
- the action String to check against.- Returns:
- true if the action String can be handled, false if it can't.
-
handle
void handle(java.util.Map<java.lang.String,java.lang.Object> data, Context context)
Invokes an action on the given action String. This is expected to be the starting of an Activity, hence theContext
parameter.- Parameters:
data
- an optional map of key-value pairs for theActionHandler
to use in handling the action.context
- theContext
to use in invoking the action, such as starting an Activity.
-
getPriority
int getPriority()
Returns the priority of the ActionHandler. The higher the number, the higher the priority.- Returns:
- the priority of the ActionHandler.
-
-