Package zendesk.chat

Interface PushNotificationsProvider



  • public interface PushNotificationsProvider
    A provider to interact with push notifications.

    You can access it as follows:

         PushNotificationsProvider pushNotificationsProvider = Chat.INSTANCE.providers().pushNotificationsProvider();
     

    Make sure to initialize Zendesk Chat SDK first before accessing the providers, see Chat.init(Context, String) for more details.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      PushData processPushNotification(java.util.Map<java.lang.String,java.lang.String> remoteMessageData)
      Processes the data from the received remote message and returns a parsed representation of the raw data.
      void registerPushToken(java.lang.String pushToken)
      Registers the push token in Zendesk Chat backend.
      void registerPushToken(java.lang.String pushToken, <any> callback)
      Registers the push token in Zendesk Chat backend.
      void unregisterPushToken()
      Unregisters the push token in Zendesk Chat backend.
      void unregisterPushToken(<any> callback)
      Unregisters the push token in Zendesk Chat backend.
    • Method Detail

      • registerPushToken

        void registerPushToken(java.lang.String pushToken)
        Registers the push token in Zendesk Chat backend.

        Call this method each time you receive a new token in FirebaseMessagingService#onNewToken(String).

        Token registration will take place once the connection with Zendesk Chat backend is established. Once the token is registered, the backend will start sending push notifications to this device only while the connection is closed and while the session remains active.

        Parameters:
        pushToken - the FCM token needed to active push notifications
      • registerPushToken

        void registerPushToken(java.lang.String pushToken,
                               <any> callback)
        Registers the push token in Zendesk Chat backend.

        Call this method each time you receive a new token in FirebaseMessagingService#onNewToken(String).

        Token registration will take place once the connection with Zendesk Chat backend is established. Once the token is registered, the backend will start sending push notifications to this device only while the connection is closed and while the session remains active.

        Parameters:
        pushToken - the FCM token needed to active push notifications
        callback - a callback to be executed when the registration is completed
      • unregisterPushToken

        void unregisterPushToken()
        Unregisters the push token in Zendesk Chat backend.

        Call this method when you wish to stop receiving push notifications.

      • unregisterPushToken

        void unregisterPushToken(<any> callback)
        Unregisters the push token in Zendesk Chat backend.

        Call this method when you wish to stop receiving push notifications.

        Parameters:
        callback - a callback to be executed when the unregistration is completed
      • processPushNotification

        PushData processPushNotification(java.util.Map<java.lang.String,java.lang.String> remoteMessageData)
        Processes the data from the received remote message and returns a parsed representation of the raw data.

        Call this method each time you receive a new RemoteMessage in FirebaseMessagingService#onNewToken(String) as follows:

             PushNotificationsProvider pushNotificationsProvider = Chat.INSTANCE.providers().pushNotificationsProvider();
             PushData pushData = pushNotificationsProvider.processPushNotification(remoteMessage.getData());
         
        Parameters:
        remoteMessageData - raw data from the remote message
        Returns:
        an instance of PushData