Package com.batch.android
Class BatchNotificationAction
java.lang.Object
com.batch.android.BatchNotificationAction
Represents a Notification Action button
-
Field Summary
Modifier and TypeFieldDescriptionActionAction identifier.CTA Drawable name.boolean
Does this action imply showing any UI or will it act in the background?CTA label textboolean
Should a tap on this action dismiss its notification? -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<androidx.core.app.NotificationCompat.Action>
getSupportActions
(Context context, List<BatchNotificationAction> batchActions, BatchPushPayload pushPayload, Integer notificationId) ConvertsBatchNotificationAction
instances 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 Details
-
actionArguments
Action -
actionIdentifier
Action identifier. Made to work withBatch.Actions
-
drawableName
CTA Drawable name. Use this to find your drawable into your resources, or use an alias system.
If usinggetSupportActions(android.content.Context,java.util.List,com.batch.android.BatchPushPayload,java.lang.Integer)
, this value can be one of the alias registered usingBatch.Actions#addDrawableAlias(String, int)
-
hasUserInterface
public boolean hasUserInterfaceDoes 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). -
label
CTA label text -
shouldDismissNotification
public boolean shouldDismissNotificationShould a tap on this action dismiss its notification?Note that for this to work, you will need to provide a valid notificationId to
getSupportActions(android.content.Context,java.util.List,com.batch.android.BatchPushPayload,java.lang.Integer)
.
-
-
Constructor Details
-
BatchNotificationAction
public BatchNotificationAction()
-
-
Method Details
-
getSupportActions
public static List<androidx.core.app.NotificationCompat.Action> getSupportActions(Context context, List<BatchNotificationAction> batchActions, BatchPushPayload pushPayload, Integer notificationId) ConvertsBatchNotificationAction
instances 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 ofBatchNotificationAction
instances to convertpushPayload
- The Batch push payload associated with these actions, if any. If not set, theUserActionSource
will not be set when your customUserActionRunnable
is called. This parameter might be required for some internal actions.notificationId
- The Id of the notification these actions will be attached to. Required forshouldDismissNotification
to work.- Returns:
- A list of
NotificationCompat.Action
instances matching the providedBatchNotificationAction
, if they've been successfully converted
-