Class Batch.Actions

java.lang.Object
com.batch.android.Batch.Actions
Enclosing class:
Batch

public static final class Batch.Actions extends Object
Batch Action manager
  • Method Details

    • register

      public static void register(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

      public static void unregister(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. Identifiers are not case-sensitive.
    • addDrawableAlias

      public static void addDrawableAlias(String alias, 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 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 sensitive
      drawableID - Drawable resource ID to use
    • performAction

      public static boolean performAction(Context context, String actionIdentifier, JSONObject arguments)
      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

      public static void setDeeplinkInterceptor(BatchDeeplinkInterceptor interceptor)
      Set a deeplink interceptor. It allows you to tweak how Batch will open your activity.
      Parameters:
      interceptor - A BatchDeeplinkInterceptor interface. Null to remove a previously set one.