Package com.batch.android
Class BatchNotificationAction
- java.lang.Object
-
- com.batch.android.BatchNotificationAction
-
public class BatchNotificationAction extends java.lang.ObjectRepresents a Notification Action button
-
-
Field Summary
Fields Modifier and Type Field Description JSONObjectactionArgumentsActionjava.lang.StringactionIdentifierAction identifier.java.lang.StringdrawableNameCTA Drawable name.booleanhasUserInterfaceDoes this action imply showing any UI or will it act in the background? An action that has no UI should not close the notification drawer, but should still dismiss the notification itself (if asked to).java.lang.StringlabelCTA label textbooleanshouldDismissNotificationShould a tap on this action dismiss its notification?
-
Constructor Summary
Constructors Constructor Description BatchNotificationAction()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<androidx.core.app.NotificationCompat.Action>getSupportActions(android.content.Context context, java.util.List<BatchNotificationAction> batchActions, BatchPushPayload pushPayload, java.lang.Integer notificationId)ConvertsBatchNotificationActioninstances toNotificationCompat.Action, allowing you to add actions to a Notification the same way the SDK internally does it, taking care of all the boilerplate.
-
-
-
Field Detail
-
label
public java.lang.String label
CTA label text
-
drawableName
public java.lang.String drawableName
CTA Drawable name. Use this to find your drawable into your resources, or use an alias system.
If usinggetSupportActions(Context, List, BatchPushPayload, Integer), this value can be one of the alias registered usingBatch.Actions.addDrawableAlias(String, int)
-
actionIdentifier
public java.lang.String actionIdentifier
Action identifier. Made to work withBatch.Actions
-
actionArguments
public JSONObject actionArguments
Action
-
hasUserInterface
public boolean hasUserInterface
Does this action imply showing any UI or will it act in the background? An action that has no UI should not close the notification drawer, but should still dismiss the notification itself (if asked to).
-
shouldDismissNotification
public boolean shouldDismissNotification
Should a tap on this action dismiss its notification?Note that for this to work, you will need to provide a valid notificationId to
getSupportActions(Context, List, BatchPushPayload, Integer).
-
-
Method Detail
-
getSupportActions
@NonNull public static java.util.List<androidx.core.app.NotificationCompat.Action> getSupportActions(@NonNull android.content.Context context, @NonNull java.util.List<BatchNotificationAction> batchActions, @Nullable BatchPushPayload pushPayload, @Nullable java.lang.Integer notificationId)ConvertsBatchNotificationActioninstances toNotificationCompat.Action, allowing you to add actions to a Notification the same way the SDK internally does it, taking care of all the boilerplate.- Parameters:
context- Your application's contextbatchActions- List ofBatchNotificationActioninstances to convertpushPayload- The Batch push payload associated with these actions, if any. If not set, theUserActionSourcewill not be set when your customUserActionRunnableis called. This parameter might be required for some internal actions.notificationId- The Id of the notification these actions will be attached to. Required forshouldDismissNotificationto work.- Returns:
- A list of
NotificationCompat.Actioninstances matching the providedBatchNotificationAction, if they've been successfully converted
-
-