public class PushNotificationClient
extends java.lang.Object
Constructor and Description |
---|
PushNotificationClient(com.azure.android.communication.common.CommunicationTokenCredential communicationTokenCredential) |
Modifier and Type | Method and Description |
---|---|
void |
addPushNotificationHandler(ChatEventType chatEventType,
java9.util.function.Consumer<ChatEvent> listener)
Add handler for a chat event for push notifications.
|
boolean |
handlePushNotification(ChatPushNotification pushNotification)
Handle incoming push notification.
|
boolean |
hasStarted()
flag to indicate if push notification has started
|
void |
removePushNotificationHandler(ChatEventType chatEventType,
java9.util.function.Consumer<ChatEvent> listener)
Remove handler from a chat event for push notifications.
|
void |
startPushNotifications(java.lang.String deviceRegistrationToken,
java9.util.function.Consumer<java.lang.Throwable> errorHandler)
Register the current device for receiving incoming push notifications via FCM.
|
void |
stopPushNotifications()
Unregister the current device from receiving incoming push notifications.
|
public PushNotificationClient(com.azure.android.communication.common.CommunicationTokenCredential communicationTokenCredential)
public boolean hasStarted()
public void startPushNotifications(java.lang.String deviceRegistrationToken, java9.util.function.Consumer<java.lang.Throwable> errorHandler)
deviceRegistrationToken
- Device registration token obtained from the FCM SDK.errorHandler
- error handler callback for registration failuresjava.lang.RuntimeException
- if push notifications failed to start.public void stopPushNotifications()
public boolean handlePushNotification(ChatPushNotification pushNotification)
pushNotification
- Incoming push notification payload from the FCM SDK.public void addPushNotificationHandler(ChatEventType chatEventType, java9.util.function.Consumer<ChatEvent> listener)
chatEventType
- the chat event typelistener
- the listener callback functionpublic void removePushNotificationHandler(ChatEventType chatEventType, java9.util.function.Consumer<ChatEvent> listener)
chatEventType
- the chat event typelistener
- the listener callback function