Interface UnbluClient

  • All Known Subinterfaces:
    UnbluAgentClient, UnbluVisitorClient

    public interface UnbluClient

    Minumum Requirements:

    Android API version 24

    Collaboration server 6.33.x or newer.

    • Method Detail

      • deinitClient

        void deinitClient​(@Nullable
                          SuccessVoidCallback success,
                          DeinitializeExceptionCallback failure)
        Deinitializes the UnbluClient.

        This is an asynchronous call. Use the callbacks to check for success / failure.

        Calling this method will free all resources allocated by the UnbluClient .

        Consecutive calls (without initializing in between) will be ignored, but the callbacks will also be triggered, as soon as there is a result.

        success - Optional callback that will be called once the API has been successfully deinitialized.
        failure - Optional callback that will be called if the deinitialization of the API fails.
      • isInErrorState

        boolean isInErrorState()
        true if the UnbluClient is in error state. false otherwise.
      • setAutoHideUiOnBack

        void setAutoHideUiOnBack​(boolean autoHideUiOnBack)
        If set to true, the Unblu UI will hide automatically if the user presses the back button and there is no more navigation inside the Unblu UI.
        Also this option has no effect if there is a BackButtonCallback configured which handles the back presses by itself.
        autoHideUiOnBack - True to enabled hiding the UI when back button is pressed, false to disable it
      • setBackButtonCallback

        void setBackButtonCallback​(@Nullable
                                   BackButtonCallback backButtonCallback)
        Defines the callback for back button presses while the Unblu UI is displayed.
        If it is null, the SDK will handle all back button presses itself. In this case it will navigate up inside the webView or, if setAutoHideUiOnBack(boolean) is true, it will hide the UI when the top level of the UI is reached.
        backButtonCallback - The listener which handles the back button press
      • setBackButtonPressTriggerEvent

        void setBackButtonPressTriggerEvent​(@NonNull
                                            BackButtonPressTriggerEvent event)
        Defines the event type for back button press trigger
        event - The event which will be listened for the back button trigger
      • isCallUiOpen

        void isCallUiOpen​(@NonNull
                          SuccessCallback<java.lang.Boolean> success,
                          NotInitializedExceptionCallback failure)
        Checks if the call UI for an audio/video call is open or not. If the call UI is minimized, the result is also false.
        If you need to check if a call is active or not, use the call module api.
        This is an asynchronous call. Use the callbacks to check for success / failure.
        success - Optional callback that will be called with the result if the UI is open or not
        failure - Optional callback that will be called if the api was not initialized
      • openConversation

        void openConversation​(@NonNull
                              java.lang.String conversationId,
                              SuccessVoidCallback success,
                              OpenConversationExceptionCallback failure)
        Opens the conversation for the given id.
        conversationId - The id of the conversation which should be opened.
        success - Called after the conversation was opened
        failure - Called if there was an error opening the conversation
      • openConversationOverview

        void openConversationOverview​(@Nullable
                                      SuccessVoidCallback success,
                                      OpenConversationOverviewExceptionCallback failure)
        Opens the overview over all conversations.
        success - Called when the overview was opened
        failure - Called if there was an error opening the overview
      • getUnreadMessagesCount

        int getUnreadMessagesCount()
        Returns the number of unread messages
        the number of unread messages
      • getPersonInfo

        PersonInfo getPersonInfo()
        Returns the information of the current person. If you are working with a UnbluVisitorClient instance, it is recommended to use UnbluVisitorClient.getPersonInfoAsync() instead. This ensures that there is a value present as due to some internal optimizations, there may not be any value present if e.g. the UI has never been displayed.
      • setCustomLoadingViewCreator

        void setCustomLoadingViewCreator​(@Nullable
                                         ICustomLoadingViewCreator customLoadingViewCreator)
        Sets a custom loading view creator.
        customLoadingViewCreator - The loading view creator which should be used whenever a loading view is displayed
      • getCustomLoadingViewCreator

        ICustomLoadingViewCreator getCustomLoadingViewCreator()
        Returns the currently configured loading view creator
        the currently configured loadingView creator
      • getNotificationApi

        UnbluNotificationApi getNotificationApi()
        Returns the low level notification API which can be used if the Unblu firebase notification module is not used.
        The notification api instance
      • setApplicationContext

        void setApplicationContext​(@NonNull
        Set the application. This is only for internal purpose
        application - The UnbluApplication or a class which should inherit it.
      • onUnreadMessagesCount

        io.reactivex.rxjava3.core.Observable<java.lang.Integer> onUnreadMessagesCount()
        Fired when the number of unread messages changes. Also fired if there are no longer unread messages
        Observable which emits an Integer
      • onPersonChanged

        io.reactivex.rxjava3.core.Observable<PersonInfo> onPersonChanged()
        Fired when the current person changes.
        This is only triggered when the used collaboration server is of version newer than 5.17 or newer than 6.3
        Observable which emits PersonInfo
      • getOpenConversation

        io.reactivex.rxjava3.core.Observable<java.util.Optional<UnbluConversation>> getOpenConversation()
        Get the current open conversation as an observable. It will always emit the current conversation. An empty optional will be emitted, if there is no open conversation.
        Observable which emits the open conversation or empty optional if there is none open.
      • isCallUiOpen

        io.reactivex.rxjava3.core.Observable<java.lang.Boolean> isCallUiOpen()
        Fired when the call ui is opened or closed. Closed can be minized or the call ended. Check the instance for callActive to determine if a call is active or not.
        Observable which emits Boolean
      • getMainView

        android.view.View getMainView()
        Returns the Unblu UI component to interact with (Chat, Calls, Video, Co-Browsing) as a View

        This instance should work as any other widget extending View, with the following exception:

        - If the instance is attached to a view inside an Activity, when Activity.onDestroy() is called, this instance will detach itself from the parent. Note: if you attached to a view inside an Activity whose category in the manifest is "android.intent.category.LAUNCHER", you may not always get this behaviour as these categorised activities usually only get destroyed alongside the application instance.

        Otherwise, if you intend to reuse the instance after it was attached to a View, you will need to make sure you first remove the getMainView() from its parent View or you will get the following error:

        IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

        Example: When attaching the mainView inside a Fragment, when eventually the Fragment View gets destroyed, you should call ViewGroup.removeView(View) from mainView's parent. You can achieve this by adding an LifecycleObserver to the Lifecycle in your Fragment:

        lifecycle.addObserver(LifecycleEventObserver { _, event -> if(event.targetState == Lifecycle.State.DESTROYED){ //remove mainView from its parent } })

        the Unblu Ui View instance
      • onApiDeInitialized

        io.reactivex.rxjava3.core.Observable<java.util.Optional<java.lang.Void>> onApiDeInitialized()
        Fired when the UnbluClient is deInitialized. This alerts you that the API cannot be used because it was deinitialized.
        an Observable which emits on deinitialization.
      • onUiReady

        io.reactivex.rxjava3.core.Observable<java.util.Optional<java.lang.Void>> onUiReady()
        Fired when the UI is ready.
        an Observable that emits once, when the UI is preloaded.
      • onUiPreloaded

        io.reactivex.rxjava3.core.Observable<java.util.Optional<java.lang.Void>> onUiPreloaded()
        Used to check if a UnbluClient instance is currently deInitialized
        true if the instance is deInitialized
      • isDeInitialized

        boolean isDeInitialized()
        Used to check if a UnbluClient instance is currently deInitialized
        if the instance is deInitialized
      • onPersonActivityChanged

        io.reactivex.rxjava3.core.Observable<java.lang.Long> onPersonActivityChanged()
        Used to check for the UTC timestamp of the last activity by the user
        an Observable that will emit the last activity timestamp
      • setAccessToken

        void setAccessToken​(java.lang.String token)
        Set the OAuth 2.0 token to pass to the service worker and add to the HTTP header.
        token - The token received from an identity provider