Package com.batch.android
Class Batch.Actions
java.lang.Object
com.batch.android.Batch.Actions
- Enclosing class:
- Batch
Batch Action manager
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addDrawableAlias
(String alias, int drawableID) Add an alias to a drawable that can be referenced remotely.static boolean
performAction
(Context context, String actionIdentifier, JSONObject arguments) Perform an action by its identifier.static void
register
(UserAction userAction) Register an action with Batch.static void
setDeeplinkInterceptor
(BatchDeeplinkInterceptor interceptor) Set a deeplink interceptor.static void
unregister
(String identifier) Unregister an action from Batch.
-
Method Details
-
register
Register an action with Batch.
If an action already exists for that identifier, it will be replaced. Identifiers are not case-sensitive. Note that the action identifier cannot start with "batch.", as they are reserved by the SDK. Trying to register such an action will throw an exception.- Parameters:
userAction
- The action to register
-
unregister
Unregister an action from Batch.
Trying to unregister an action that has not be unregistered will silently fail. Note that trying to unregister an action that starts with "batch." will throw an exception.- Parameters:
identifier
- The action identifier. Identifiers are not case-sensitive.
-
addDrawableAlias
Add an alias to a drawable that can be referenced remotely.
This is used for CTAs (buttons) showing in the push notifications themselves. While you can directly set a drawable resource when making your notification, it is recommended that you add a set of aliases. That way, you can change the drawable file name between versions without having to think about that when pushing different versions of your applications. You can also use aliases to make the icon names more readable or useful to anybody sending notifications to your app.
Note that since Android N, notifications with button will not display icons anymore.- Parameters:
alias
- Drawable alias. Not case sensitivedrawableID
- Drawable resource ID to use
-
performAction
Perform an action by its identifier.
Note: The action will have a null source.- Parameters:
actionIdentifier
- Action identifier. Batch internal actions cannot be called using this method.arguments
- Action arguments. Optional.- Returns:
- true if an action was registered for this identifier and performed, false otherwise.
-
setDeeplinkInterceptor
Set a deeplink interceptor. It allows you to tweak how Batch will open your activity.- Parameters:
interceptor
- ABatchDeeplinkInterceptor
interface. Null to remove a previously set one.
-