-
public final class Batch.ActionsBatch Action manager
-
-
Method Summary
Modifier and Type Method Description static voidregister(@NonNull() UserAction userAction)Register an action with Batch. static voidunregister(@NonNull() String identifier)Unregister an action from Batch. static voidaddDrawableAlias(@NonNull() String alias, @DrawableRes() int drawableID)Add an alias to a drawable that can be referenced remotely. static booleanperformAction(@NonNull() Context context, @NonNull() String actionIdentifier, @Nullable() JSONObject arguments)Perform an action by its identifier. static voidsetDeeplinkInterceptor(@Nullable() BatchDeeplinkInterceptor interceptor)Set a deeplink interceptor. -
-
Method Detail
-
register
static void register(@NonNull() UserAction userAction)
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
static void unregister(@NonNull() String identifier)
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.
-
addDrawableAlias
static void addDrawableAlias(@NonNull() String alias, @DrawableRes() int drawableID)
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 whenpushing 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.drawableID- Drawable resource ID to use
-
performAction
static boolean performAction(@NonNull() Context context, @NonNull() String actionIdentifier, @Nullable() JSONObject arguments)
Perform an action by its identifier.Note: The action will have a null source.
- Parameters:
actionIdentifier- Action identifier.arguments- Action arguments.
-
setDeeplinkInterceptor
static void setDeeplinkInterceptor(@Nullable() BatchDeeplinkInterceptor interceptor)
Set a deeplink interceptor. It allows you to tweak how Batch will open your activity.
- Parameters:
interceptor- A BatchDeeplinkInterceptor interface.
-
-
-
-