Package com.batch.android
Class BatchNotificationInterceptor
- java.lang.Object
-
- com.batch.android.BatchNotificationInterceptor
-
public abstract class BatchNotificationInterceptor extends java.lang.ObjectAbstract class describing a notification interceptor.An interceptor's job is to override some aspects of a notification that Batch wants to display. See the various methods to see what you can override.
-
-
Constructor Summary
Constructors Constructor Description BatchNotificationInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description androidx.core.app.NotificationCompat.BuildergetPushNotificationCompatBuilder(android.content.Context context, androidx.core.app.NotificationCompat.Builder defaultBuilder, android.os.Bundle pushIntentExtras, int notificationId)Get the builder instance used to generate the notification.
If you're basing your builder on defaultBuilder, some methods might have undefined behaviour as Batch already calls many of them.
Likewise, returning another instance of the builder than defaultBuilder's might result in loss of functionality if not reimplemented.intgetPushNotificationId(android.content.Context context, int defaultId, android.os.Bundle pushIntentExtras)Notification Id to use when posting the notification to the system.
-
-
-
Method Detail
-
getPushNotificationCompatBuilder
@Nullable public androidx.core.app.NotificationCompat.Builder getPushNotificationCompatBuilder(@NonNull android.content.Context context, @NonNull androidx.core.app.NotificationCompat.Builder defaultBuilder, @NonNull android.os.Bundle pushIntentExtras, int notificationId)Get the builder instance used to generate the notification.
If you're basing your builder on defaultBuilder, some methods might have undefined behaviour as Batch already calls many of them.
Likewise, returning another instance of the builder than defaultBuilder's might result in loss of functionality if not reimplemented.- Parameters:
context- Context. Will usually be a service context.defaultBuilder- NotificationCompat builder that has been created and fully configured by Batch.pushIntentExtras- Raw push intent extras. Read directly your custom payload values from the extras as string values, or useBatchPushPayload.payloadFromReceiverExtras(Bundle)to extract Batch data from the extras.notificationId- Notification id that will be used to post the notification. Result ofgetPushNotificationId(Context, int, Bundle).- Returns:
- A valid
NotificationCompat.Builderinstance, or null if you want to stop the display of that notification.
-
getPushNotificationId
public int getPushNotificationId(@NonNull android.content.Context context, int defaultId, @NonNull android.os.Bundle pushIntentExtras)Notification Id to use when posting the notification to the system. This id should be unique per notification, unless you want to update it with other pushes (such as a sports game score update, for example) If you always return the same value, the notification can behave unexpectedly.- Parameters:
context- Context. Will usually be a service context.defaultId- Notification Id that was generated and about to be used by BatchpushIntentExtras- Raw push intent extras. Read directly your custom payload values from the extras as string values, or useBatchPushPayload.payloadFromReceiverExtras(Bundle)to extract Batch data from the intent.- Returns:
- A valid notification id.
-
-