Object PushNotifications

  • All Implemented Interfaces:

    
    public class PushNotifications
    
                        

    Public entry point to use push notifications with zendesk.android.messaging.Messaging.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • validatePushIntegration

         final static Boolean validatePushIntegration(Context context, Map<String, String> messageData)

        If the integrator is switching between different integrations (messaging channels) it is possible that the SDK can receive a push notification for an integration that has already been replaced. This function validates the push notification payload belongs to the current active integration (messaging channel)

        Parameters:
        context - the Context used to fetch the cached integration id to compare with the push notification
        messageData - the data received from the push notification
        Returns:

        a Boolean indicating if the push notification is valid for the current SDK instance

      • updatePushNotificationToken

         final static Unit updatePushNotificationToken(String pushNotificationToken)

        Updates the pushNotificationToken associated with this device to receive push notifications.

        This function can be called at any time. The pushNotificationToken is only be updated once a zendesk.conversationkit.android.model.User becomes available. If one was not available when this method was called, then the SDK will defer the update automatically.

        Parameters:
        pushNotificationToken - the device token for receiving push notifications
      • shouldBeDisplayed

         final static PushResponsibility shouldBeDisplayed(Map<String, String> messageData)

        When receiving a push notification payload, this method can be used to check if it belongs to Messaging and if it can be displayed. It also checks the current conversation on the conversation screen to prevent notifications being shown for a matching conversation

        Parameters:
        messageData - the data received from the push notification
        Returns:

        an instance of PushResponsibility

      • displayNotification

         final static Unit displayNotification(Context context, Map<String, String> messageData)

        Displays the given messageData as a push notification in the system tray if the push belongs to Messaging and the SDK is able to display it.

        If the message doesn't belong to Messaging or the SDK is unable to display the message then this method will return early, without displaying the push notification.

        Parameters:
        context - an instance of Context
        messageData - the data received from the push notification