Class CommunicationManager

java.lang.Object
com.gimbal.android.CommunicationManager

public class CommunicationManager extends Object
Defines the interface for delivering Gimbal Communications to your Gimbal SDK enabled app. Use this class to start or stop receiving Communications and to adjust the delivery of user Notifications.
  • Method Details

    • getInstance

      public static CommunicationManager getInstance()
      Returns an instance of CommunicationManager
      Returns:
      an instance of CommunicationManager
    • startReceivingCommunications

      public void startReceivingCommunications()
      Enables the CommunicationManager to receive Gimbal Communications from Gimbal Manager and deliver them to end users
    • stopReceivingCommunications

      public void stopReceivingCommunications()
      Stops all communication delivery. This includes both time (scheduled and instant push) and place-triggered communications.
    • isReceivingCommunications

      public boolean isReceivingCommunications()
      Returns whether the CommunicationManager has been enabled
      Returns:
      true if the CommunicationManager is enabled
    • addListener

      public void addListener(CommunicationListener communicationListener)
      Adds a CommunicationListener for notification of Communications. Note that the SDK only holds a weak reference to the listener, so the app must retain a reference to prevent the listener from being garbage collected.
      Parameters:
      communicationListener - the CommunicationListener that will receive events
    • removeListener

      public void removeListener(CommunicationListener communicationListener)
      Unregisters the specified CommunicationListener so that it will not receive Communications
      Parameters:
      communicationListener - the CommunicationListener that will no longer receive events
    • setNotificationChannelId

      public void setNotificationChannelId(String notificationChannelId)
      Specifies a NotificationChannel to be used by Communication notifications. If set to non-null, the app is responsible for creating and managing this channel.

      If an app sets this to non-null and later wishes to let the Gimbal SDK use its own default channel, the old channel must be cleared by setting this to null.

      Parameters:
      notificationChannelId - the identifier for the NotificationChannel to be set for Communication notifications.
      Since:
      3.0
    • getNotificationChannelId

      public String getNotificationChannelId()
      Returns the identifier of the NotificationChannel to be used by Communication notifications.
      Returns:
      the notification channel identifier
      Since:
      3.0
    • enablePushMessaging

      @Deprecated public void enablePushMessaging(boolean enable)
      Deprecated.
      Enables or disables Gimbal SDK's internal FirebaseMessagingService for handling of push messaging for the application instance. This only needs to be called once per app instance. If Gimbal.registerForPush() had been called on an existing app instance with a previous version of the SDK, the V4 SDK will migrate this setting to effectively call enablePushMessaging(true).

      In order for push messages to be received, the CommunicationManager will need to be started, and Firebase will need to be configured for the application.

      If using multiple push providers, do not call this (or set to false) and delegate messages and tokens received by the client application to handleMessageReceived and handleNewToken, respectively.

      See the Developer's Guide for additional information.

      Parameters:
      enable - true to enable push messaging
      Since:
      4.2.0
    • handleMessageReceived

      @Deprecated public boolean handleMessageReceived(com.google.firebase.messaging.RemoteMessage remoteMessage, android.content.Context context)
      Deprecated.
      Forwards a message from the app's implementation of FirebaseMessagingService.onMessageReceived() to the Gimbal SDK for processing of Communications. Messages that are not a Gimbal Communication are ignored. Returns whether or not the message was a Gimbal Communication.
      Parameters:
      remoteMessage - the RemoteMessage received from Firebase
      context - a Context the SDK can use in processing the message, typically the FirebaseMessagingService used to receive this message
      Returns:
      true if the message is a Gimbal Communication
      Since:
      4.2.0
    • handleNewToken

      @Deprecated public void handleNewToken(String newToken)
      Deprecated.
      Forwards a push token from the app's implementation of FirebaseMessagingService.onTokenReceived() to the Gimbal SDK
      Parameters:
      newToken - the new push token String received from Firebase
      Since:
      4.2.0