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
Notification
s.-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(CommunicationListener communicationListener) Adds aCommunicationListener
for notification ofCommunication
s.void
enablePushMessaging
(boolean enable) Deprecated.static CommunicationManager
Returns an instance ofCommunicationManager
Returns the identifier of theNotificationChannel
to be used by Communication notifications.boolean
handleMessageReceived
(com.google.firebase.messaging.RemoteMessage remoteMessage, android.content.Context context) Deprecated.void
handleNewToken
(String newToken) Deprecated.boolean
Returns whether the CommunicationManager has been enabledvoid
removeListener
(CommunicationListener communicationListener) Unregisters the specifiedCommunicationListener
so that it will not receiveCommunication
svoid
setNotificationChannelId
(String notificationChannelId) Specifies aNotificationChannel
to be used by Communication notifications.void
Enables the CommunicationManager to receive Gimbal Communications from Gimbal Manager and deliver them to end usersvoid
Stops 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:
true
if the CommunicationManager is enabled
-
addListener
Adds aCommunicationListener
for notification ofCommunication
s. 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
- theCommunicationListener
that will receive events
-
removeListener
Unregisters the specifiedCommunicationListener
so that it will not receiveCommunication
s- Parameters:
communicationListener
- theCommunicationListener
that will no longer receive events
-
setNotificationChannelId
Specifies aNotificationChannel
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 tonull
.- Parameters:
notificationChannelId
- the identifier for theNotificationChannel
to be set for Communication notifications.- Since:
- 3.0
-
getNotificationChannelId
Returns the identifier of theNotificationChannel
to be used by Communication notifications.- Returns:
- the notification channel identifier
- Since:
- 3.0
-
enablePushMessaging
Deprecated.Enables or disables Gimbal SDK's internalFirebaseMessagingService
for 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
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 tohandleMessageReceived
andhandleNewToken
, 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 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
- theRemoteMessage
received from Firebasecontext
- aContext
the SDK can use in processing the message, typically theFirebaseMessagingService
used to receive this message- Returns:
true
if 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 tokenString
received from Firebase- Since:
- 4.2.0
-