public static final class BatchHms.Push
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BATCH_BUNDLE_KEY
Key used in a push bundle
|
| Modifier and Type | Method and Description |
|---|---|
static void |
appendBatchData(com.huawei.hms.push.RemoteMessage remoteMessage,
android.content.Intent openIntent)
Append Batch data to your open intent so that opens from this push will be tracked by Batch and displayed into your dashboard.
|
static void |
displayNotification(android.content.Context context,
com.huawei.hms.push.RemoteMessage remoteMessage)
Call this method to display the notification for this message.
|
static void |
displayNotification(android.content.Context context,
com.huawei.hms.push.RemoteMessage remoteMessage,
com.batch.android.BatchNotificationInterceptor interceptor)
Call this method to display the notification for this message.
|
static boolean |
isBatchPush(com.huawei.hms.push.RemoteMessage remoteMessage)
Check if the received push is a Batch one.
|
static android.app.PendingIntent |
makePendingIntent(android.content.Context context,
android.content.Intent intent,
com.huawei.hms.push.RemoteMessage remoteMessage)
Make a PendingIntent suitable for notifications from a given Intent.
|
static android.app.PendingIntent |
makePendingIntentForDeeplink(android.content.Context context,
java.lang.String deeplink,
com.huawei.hms.push.RemoteMessage remoteMessage)
Make a PendingIntent suitable for notifications from a given deeplink.
|
static void |
onNotificationDisplayed(android.content.Context context,
com.huawei.hms.push.RemoteMessage remoteMessage)
Call this method when you just displayed a Batch push notification by yourself.
|
static boolean |
shouldDisplayPush(android.content.Context context,
com.huawei.hms.push.RemoteMessage remoteMessage)
Should the developer handle and display this push, or will Batch display it?
Use this method to know if Batch will ignore this push, and that displaying it is your responsibility
|
public static final java.lang.String BATCH_BUNDLE_KEY
public static boolean isBatchPush(com.huawei.hms.push.RemoteMessage remoteMessage)
remoteMessage - Huawei RemoteMessagepublic static void appendBatchData(@NonNull
com.huawei.hms.push.RemoteMessage remoteMessage,
@NonNull
android.content.Intent openIntent)
remoteMessage - the Huawei message contentopenIntent - the intent of the notification the will be triggered when the user clicks on it@NonNull
public static android.app.PendingIntent makePendingIntent(@NonNull
android.content.Context context,
@NonNull
android.content.Intent intent,
@NonNull
com.huawei.hms.push.RemoteMessage remoteMessage)
BatchNotificationInterceptor implementations.
Warning: it will override the intent's action with a unique name, to ensure that existing notifications are not updated with this PendingIntent's content. If you rely on a custom action, you will have to make your own PendingIntent.
context - Context. Cannot be null.intent - The intent you want to be triggered when performing the pending intent. Must be an intent compatible with PendingIntent.getActivity(Context, int, Intent, int). Cannot be null.remoteMessage - Raw Huawei message, used to copy data used by Batch to power features such as direct opens, or mobile landings. Cannot be null.
If these extras don't have valid Batch data in it, a valid PendingIntent will still be returned, but some features might not work correctly.@Nullable
public static android.app.PendingIntent makePendingIntentForDeeplink(@NonNull
android.content.Context context,
@NonNull
java.lang.String deeplink,
@NonNull
com.huawei.hms.push.RemoteMessage remoteMessage)
This is useful for custom receivers, or BatchNotificationInterceptor implementations.
context - Context. Cannot be null.deeplink - Deeplink string. Cannot be null.remoteMessage - Raw Huawei message content, used to copy data used by Batch to power features such as direct opens, or mobile landings. Cannot be null.
If these extras don't have valid Batch data in it, a valid PendingIntent will still be returned, but some features might not work correctly.public static boolean shouldDisplayPush(android.content.Context context,
com.huawei.hms.push.RemoteMessage remoteMessage)
context - ContextremoteMessage - The Huawei messagepublic static void displayNotification(android.content.Context context,
com.huawei.hms.push.RemoteMessage remoteMessage)
context - ContextremoteMessage - The Huawei messagepublic static void displayNotification(@NonNull
android.content.Context context,
@NonNull
com.huawei.hms.push.RemoteMessage remoteMessage,
@Nullable
com.batch.android.BatchNotificationInterceptor interceptor)
Batch.Push#setNotificationInterceptor(BatchNotificationInterceptor)
Note that this method will spawn a new thread if ran on the main thread, and thus
becomes asynchronous.context - ContextremoteMessage - The Huawei messageinterceptor - Interceptor to usepublic static void onNotificationDisplayed(android.content.Context context,
com.huawei.hms.push.RemoteMessage remoteMessage)
context - ContextremoteMessage - The Huawei message