public class UnbluVisitorApi
extends com.unblu.visitorsdk.internal.InternalUnbluVisitorApi
Before using the API, ensure that in your app manifest file points you use either the class UnbluVisitorApplication or a custom subclass of it for the application. Check its class documentation for further details.
If you want to use audio/video sessions, please ensure the following permissions are added to your manifest.xml
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
Before calling any other function configureApi(UnbluVisitorApiConfiguration) should be called inside main activity Activity.onCreate(Bundle).
The constants of IUnbluEventApi can be used to register for events via a BroadcastReceiver and access their values. The easier way is to subclass the UnbluEventReceiver and override the methods according to the events which you want to listen for.
A typical flow for the usage would be:
Activity.onCreate(Bundle) {
UnbluVisitorApi.getInstance().UnbluCoreApi.configureApi(UnbluCoreApiConfiguration)
//register for general errors and/or also other events
unbluBroadcastReceiver = new UnbluEventReceiver(getApplicationContext()) {
...
//start the api. This could also be done later when it is needed, but it will take a while until the api is ready.
UnbluVisitorApi.getInstance().UnbluCoreApi.initApi(IUnbluApiSuccessfullyInitializedCallback, IUnbluApiInitializeExceptionCallback)(success: {<success handling>}, failure: {<error handling>}))
...
}
showUnblUi {
//the unblu UI should be shown
UnbluVisitorApi.UnbluCoreApi.showUi(boolean, IUnbluApiSuccessVoidCallback, IUnbluShowUiExceptionCallback)(true, success: {<success handling>}, failure: {<error handling>});
}
ANIMATION_TIME, enableCapturingPerformanceLogging, enableDebugOutput| Modifier and Type | Method and Description |
|---|---|
void |
configureApi(UnbluVisitorApiConfiguration configuration)
Configures the unblu api.
|
static UnbluVisitorApi |
getInstance() |
void |
isAgentAvailable(IUnbluApiSuccessCallback<java.lang.Boolean> success,
IUnbluApiNotInitializedExceptionCallback failure)
Checks if at least one agent is available for co-browsing / chat.
|
void |
joinConversation(java.lang.String pin,
IUnbluApiSuccessCallback<java.lang.String> success,
com.unblu.coresdk.internal.IUnbluApiInitConversationExceptionCallback failure)
Joins an unblu co-browsing session that was started by an agent.
|
void |
startConversation(ConversationType conversationType,
IUnbluApiSuccessCallback<java.lang.String> success,
com.unblu.coresdk.internal.IUnbluApiInitConversationExceptionCallback failure)
Starts a new conversation with the given conversation type.
|
addPrivateView, configureApi, deinitApi, getApplication, getCustomLoadingViewCreator, getLogLevel, getOpenConversationId, getPersonInfo, getUiBottomMargin, getUiTopMargin, getUnreadMessagesCount, initApi, internalGetCoreInstance, isCallActive, isCallUiOpen, isInErrorState, isInitialized, isMobileCoBrowsingActive, isNotificationsEnabled, isUiVisible, openConversation, openConversationOverview, preloadUi, removePrivateArea, removePrivateView, setAutoHideUiOnBack, setBackButtonCallback, setCustomCookies, setCustomLoadingViewCreator, setLogLevel, setNamedArea, setPrivateArea, setScreenCapturer, setUiMargins, showUi, showUi, startAudioCall, startVideoCall, stopMobileCoBrowsingpublic static UnbluVisitorApi getInstance()
UnbluVisitorApi. Only for internal use!public void configureApi(@NonNull
UnbluVisitorApiConfiguration configuration)
UnbluCoreApi.initApi(IUnbluApiSuccessfullyInitializedCallback, IUnbluApiInitializeExceptionCallback) to be able start new sessions and use other API features.
Note:
configureApi in class com.unblu.visitorsdk.internal.InternalUnbluVisitorApiconfiguration - The configuration for the unblu apijava.lang.IllegalStateException - Thrown if the api was already initialized. The api needs to be deinitialized to configure it.public void startConversation(@NonNull
ConversationType conversationType,
@Nullable
IUnbluApiSuccessCallback<java.lang.String> success,
@Nullable
com.unblu.coresdk.internal.IUnbluApiInitConversationExceptionCallback failure)
UnbluCoreApi.showUi(boolean, IUnbluApiSuccessVoidCallback, IUnbluShowUiExceptionCallback) is needed to show the conversation.
This is an asynchronous call. Use the callbacks to check for success / failure.
startConversation in class com.unblu.visitorsdk.internal.InternalUnbluVisitorApiconversationType - The initial type of the new conversation.success - Optional callback that will be called with the conversationId after the conversation was started and is display (if there is a UI).failure - Optional callback if there was problem to start the conversation.public void joinConversation(@NonNull
java.lang.String pin,
@Nullable
IUnbluApiSuccessCallback<java.lang.String> success,
@Nullable
com.unblu.coresdk.internal.IUnbluApiInitConversationExceptionCallback failure)
This is an asynchronous call. Use the callbacks to check for success / failure.
joinConversation in class com.unblu.visitorsdk.internal.InternalUnbluVisitorApipin - The pin of the conversation which shall be joined. (The pin is provided by the agent desk.)success - Optional callback that will be called with the conversationId once the conversation was successfully joined.failure - Optional callback that will be called if the conversation could not be joined.public void isAgentAvailable(@NonNull
IUnbluApiSuccessCallback<java.lang.Boolean> success,
@Nullable
IUnbluApiNotInitializedExceptionCallback failure)
This is an asynchronous call. Use the callbacks to check for success / failure.
isAgentAvailable in class com.unblu.visitorsdk.internal.InternalUnbluVisitorApisuccess - Callback that will be called with true if at least one agent is available, false otherwise.failure - Optional callback that will be called on failure.