Package com.gimbal.android
Class CommunicationManager
java.lang.Object
com.gimbal.android.CommunicationManager
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 Summary
Modifier and TypeMethodDescriptionvoidaddListener(CommunicationListener communicationListener) Adds aCommunicationListenerfor notification ofCommunications.voidenablePushMessaging(boolean enable) Deprecated.static CommunicationManagerReturns an instance ofCommunicationManagerReturns the identifier of theNotificationChannelto be used by Communication notifications.booleanhandleMessageReceived(com.google.firebase.messaging.RemoteMessage remoteMessage, android.content.Context context) Deprecated.voidhandleNewToken(String newToken) Deprecated.booleanReturns whether the CommunicationManager has been enabledvoidremoveListener(CommunicationListener communicationListener) Unregisters the specifiedCommunicationListenerso that it will not receiveCommunicationsvoidsetNotificationChannelId(String notificationChannelId) Specifies aNotificationChannelto be used by Communication notifications.voidEnables the CommunicationManager to receive Gimbal Communications from Gimbal Manager and deliver them to end usersvoidStops all communication delivery.
-
Method Details
-
getInstance
Returns an instance ofCommunicationManager- 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:
trueif the CommunicationManager is enabled
-
addListener
Adds aCommunicationListenerfor notification ofCommunications. 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- theCommunicationListenerthat will receive events
-
removeListener
Unregisters the specifiedCommunicationListenerso that it will not receiveCommunications- Parameters:
communicationListener- theCommunicationListenerthat will no longer receive events
-
setNotificationChannelId
Specifies aNotificationChannelto 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-
nulland later wishes to let the Gimbal SDK use its own default channel, the old channel must be cleared by setting this tonull.- Parameters:
notificationChannelId- the identifier for theNotificationChannelto be set for Communication notifications.- Since:
- 3.0
-
getNotificationChannelId
Returns the identifier of theNotificationChannelto be used by Communication notifications.- Returns:
- the notification channel identifier
- Since:
- 3.0
-
enablePushMessaging
Deprecated.Enables or disables Gimbal SDK's internalFirebaseMessagingServicefor handling of push messaging for the application instance. This only needs to be called once per app instance. IfGimbal.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 callenablePushMessaging(true).In order for push messages to be received, the
CommunicationManagerwill 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 tohandleMessageReceivedandhandleNewToken, respectively.See the Developer's Guide for additional information.
- Parameters:
enable-trueto 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 ofFirebaseMessagingService.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- theRemoteMessagereceived from Firebasecontext- aContextthe SDK can use in processing the message, typically theFirebaseMessagingServiceused to receive this message- Returns:
trueif the message is a Gimbal Communication- Since:
- 4.2.0
-
handleNewToken
Deprecated.Forwards a push token from the app's implementation ofFirebaseMessagingService.onTokenReceived()to the Gimbal SDK- Parameters:
newToken- the new push tokenStringreceived from Firebase- Since:
- 4.2.0
-