public abstract class UnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
extends com.unblu.coresdk.internal.InternalUnbluCoreApi<T>
Modifier and Type | Field and Description |
---|---|
static long |
ANIMATION_TIME
The time used for the fade in and fade out animation when showing/hiding the UI
|
static boolean |
enableCapturingPerformanceLogging
Enables logging of capturing performance (e.g.
|
static boolean |
enableDebugOutput
Enables the debug output of the Unblu SDK.
|
Modifier | Constructor and Description |
---|---|
protected |
UnbluCoreApi(T apiDelegate) |
Modifier and Type | Method and Description |
---|---|
void |
addPrivateView(int id)
Adds the view with the given id to the set of private views.
|
void |
configureApi(UnbluCoreApiConfiguration configuration)
Configures the unblu api.
|
void |
deinitApi(IUnbluApiSuccessVoidCallback success,
IUnbluDeinitializeExceptionCallback failure)
Deinitializes the unblu API.
|
android.app.Application |
getApplication()
Returns the application context object
|
IUnbluCustomLoadingViewCreator |
getCustomLoadingViewCreator()
Returns the currently configured loading view creator
|
static LogLevel |
getLogLevel()
Returns the log level of the Unblu SDK.
|
java.lang.String |
getOpenConversationId()
Returns the id of the currently opened conversation inside the UI.
Null if no conversation is open |
PersonInfo |
getPersonInfo()
Returns the info of the current person
|
int |
getUiBottomMargin()
Returns the current bottom margin of the unblu Ui
|
int |
getUiTopMargin()
Returns the current top margin of the unblu Ui
|
int |
getUnreadMessagesCount()
Returns the number of unread messages
|
void |
initApi(IUnbluApiSuccessfullyInitializedCallback success,
IUnbluApiInitializeExceptionCallback failure)
Inits the unblu API.
|
static <D extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate> |
internalGetCoreInstance() |
void |
isCallActive(IUnbluApiSuccessCallback<java.lang.Boolean> success,
IUnbluApiNotInitializedExceptionCallback failure)
Returns if there is currently a call or not.
|
void |
isCallUiOpen(IUnbluApiSuccessCallback<java.lang.Boolean> success,
IUnbluApiNotInitializedExceptionCallback failure)
Checks if the call UI for an audio/video call is open or not.
|
boolean |
isInErrorState() |
boolean |
isInitialized() |
boolean |
isMobileCoBrowsingActive()
Checks if mobile co-browsing is active
|
boolean |
isNotificationsEnabled() |
boolean |
isUiVisible()
Checks if the UI is visible or not
|
void |
openConversation(java.lang.String conversationId,
IUnbluApiSuccessVoidCallback success,
IUnbluApiOpenConversationExceptionCallback failure)
Opens the conversation for the given id.
The unblu UI must have been visible at least once. |
void |
openConversationOverview(IUnbluApiSuccessVoidCallback success,
IUnbluApiOpenConversationOverviewExceptionCallback failure)
Opens the overview over all conversations.
The unblu UI must have been visible at least once. |
void |
preloadUi(IUnbluApiSuccessVoidCallback success,
IUnbluApiNotInitializedExceptionCallback failure)
Starts pre loading the chat ui.
|
void |
removePrivateArea(java.lang.String id)
Removes the private area for the given id which was previously added via
setPrivateArea(String, int, int, int, int) . |
void |
removePrivateView(int id)
Removes the view with the given id from the set of private views.
|
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 IBackButtonCallback configured which handles the back presses by itself. |
void |
setBackButtonCallback(IBackButtonCallback 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. |
void |
setCustomCookies(java.util.Map<java.lang.String,java.lang.String> customCookies)
Sets the given cookies for the configured unblu base url.
|
void |
setCustomLoadingViewCreator(IUnbluCustomLoadingViewCreator customLoadingViewCreator)
Sets a custom loading view creator.
|
static void |
setLogLevel(LogLevel logLevel)
Sets the log level of the Unblu SDK.
|
void |
setNamedArea(java.lang.String namedArea)
Sets or updates the named area.
|
PrivateArea |
setPrivateArea(java.lang.String id,
int x,
int y,
int width,
int height)
Adds or updates a private area with the given size and position.
|
void |
setScreenCapturer(com.unblu.coresdk.internal.module.capturing.IScreenCapturer screenCapturer)
Set the screenCapturer to be used
|
void |
setUiMargins(int top,
int bottom)
Sets a margins of the UI.
This can be used, if there should be a an open/close fab button or some menu at the top. The top margin starts bellow the status bar. The bottom margin starts above the navigation bar, if navigation bar is visible. |
void |
showUi(boolean show,
boolean animate,
IUnbluApiSuccessVoidCallback success,
IUnbluShowUiExceptionCallback failure)
This will show/hide the UI.
|
void |
showUi(boolean show,
IUnbluApiSuccessVoidCallback success,
IUnbluShowUiExceptionCallback failure)
This will show/hide the UI.
This will animate the show/hide of the UI. |
void |
startAudioCall(java.lang.String conversationId,
IUnbluApiSuccessVoidCallback success,
IUnbluApiStartAudioCallExceptionCallback failure)
Opens a conversation for the given conversation id and starts an audio call.
The unblu UI must have been visible at least once. |
void |
startVideoCall(java.lang.String conversationId,
IUnbluApiSuccessVoidCallback success,
IUnbluApiStartVideoCallExceptionCallback failure)
Opens a conversation for the given conversation id and starts a video call.
The unblu UI must have been visible at least once. |
void |
stopMobileCoBrowsing(IUnbluApiSuccessVoidCallback success,
IUnbluApiStopMobileCoBrowsingExceptionCallback failure)
Stops mobile co-browsing
|
public static boolean enableDebugOutput
setLogLevel(LogLevel)
.public static boolean enableCapturingPerformanceLogging
IMPORTANT: This only has effect, if enableDebugOutput
is set to true and the log level is set to LogLevel.DEBUG
via setLogLevel(LogLevel)
!
public static final long ANIMATION_TIME
protected UnbluCoreApi(T apiDelegate)
public static <D extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate> UnbluCoreApi<D> internalGetCoreInstance()
UnbluCoreApi
. Only for internal use!java.lang.IllegalStateException
- If the core api was not initialized by either using UnbluVisitorApi or UnbluAgentApipublic static void setLogLevel(LogLevel logLevel)
LogLevel.VERBOSE
as in release builds the verbose and debug logs are stripped out via proguard.logLevel
- Level which should be setgetLogLevel()
public static LogLevel getLogLevel()
setLogLevel(LogLevel)
public android.app.Application getApplication()
getApplication
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
public void configureApi(UnbluCoreApiConfiguration configuration)
initApi(IUnbluApiSuccessfullyInitializedCallback, IUnbluApiInitializeExceptionCallback)
to be able start new conversation and use other API features.
Note:
configureApi
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
configuration
- 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 initApi(@Nullable IUnbluApiSuccessfullyInitializedCallback success, @Nullable IUnbluApiInitializeExceptionCallback failure)
This is an asynchronous call. Any further calls can be done inside the success callback or after the IUnbluEventApi.ApiIsInitialized
event.
Connects to the unblu server and makes the API ready for further calls.
Consecutive calls (without deinitializing in between) will be ignored, but the callbacks will also be triggered, as soon as there is a result.
initApi
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
success
- Optional callback that will be called once the API has been successfully initialized and also provides a callback if the pre loading chat ui was loaded (if preloading was enabled)failure
- Optional callback that will be called if the initialization of the API fails.public void deinitApi(@Nullable IUnbluApiSuccessVoidCallback success, @Nullable IUnbluDeinitializeExceptionCallback failure)
This is an asynchronous call. Use the callbacks to check for success / failure.
Calling this method will free all resources allocated by the unblu API.
Consecutive calls (without initializing in between) will be ignored, but the callbacks will also be triggered, as soon as there is a result.
deinitApi
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
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.public boolean isInitialized()
isInitialized
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
public boolean isNotificationsEnabled()
isNotificationsEnabled
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
public boolean isInErrorState()
isInErrorState
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
public void preloadUi(@Nullable IUnbluApiSuccessVoidCallback success, @Nullable IUnbluApiNotInitializedExceptionCallback failure)
configureApi(UnbluCoreApiConfiguration)
is set to true, this call is not needed
This is an asynchronous call. Use the callbacks to check for success / failure.
preloadUi
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
success
- Optional callback that will be called once the preloading is finished.failure
- Optional callback that will be called if the api was not initialized.public void addPrivateView(int id)
Private views are only visible on the mobile device and won't be transmitted when co-browsing. The views will be covered before they are transmitted and therefore won't be visible on the agent side.
Note:
Do not add to many ids simultaneously, because each private view will need extra performance while capturing the UI. The best practice is to dynamically make views private, when they are displayed in the app UI and remove them from the private view list when they are not visible anymore.
Multiple calls with the same id do not have any effect.
addPrivateView
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
id
- Id of the view that should be made private.public void removePrivateView(int id)
Multiple calls with the same id do not have any effect.
removePrivateView
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
id
- Id of the view that should removed from the private views.addPrivateView(int)
public PrivateArea setPrivateArea(java.lang.String id, int x, int y, int width, int height)
Private areas are only visible on the mobile device and won't be transmitted when co-browsing. The area will be covered before the captured screen is transmitted and therefore won't be visible on the agent side.
To update a private area either call this function with the same id again, or modify the returned PrivateArea
.
Changes to the returned private area or using this function will directly be applied, even if co-browsing is already active.
Note:
Try to reduce the number of private areas to a minimum as this will impact performance during co-browsing.
setPrivateArea
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
id
- The unique id of the private area which can be used to update the values or to remove the private area againx
- The x position on the screen for the private areay
- The y position on the screen for the private areawidth
- The width of the private areaheight
- The height of the private areaPrivateArea
which can be updated instead of using this API functionremovePrivateArea(String)
public void removePrivateArea(java.lang.String id)
setPrivateArea(String, int, int, int, int)
.
Multiple calls with the id do not have any effect.
removePrivateArea
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
id
- of the area that should removed from the private areas.setPrivateArea(String, int, int, int, int)
public void setCustomCookies(@NonNull java.util.Map<java.lang.String,java.lang.String> customCookies)
deinitApi(IUnbluApiSuccessVoidCallback, IUnbluDeinitializeExceptionCallback)
was called. When initApi(IUnbluApiSuccessfullyInitializedCallback, IUnbluApiInitializeExceptionCallback)
is called again the last cookies set will be used again.setCustomCookies
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
customCookies
- The cookies which will be send with request to the configured base urlpublic void setAutoHideUiOnBack(boolean autoHideUiOnBack)
IBackButtonCallback
configured which handles the back presses by itself.setAutoHideUiOnBack
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
autoHideUiOnBack
- True to enabled hiding the UI when back button is pressed, false to disable itpublic void setNamedArea(@Nullable java.lang.String namedArea)
setNamedArea
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
namedArea
- The named area meta tag id which is configured on the agent desk.public void setBackButtonCallback(@Nullable IBackButtonCallback backButtonCallback)
setAutoHideUiOnBack(boolean)
is true,
it will hide the UI when the top level of the UI is reached.setBackButtonCallback
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
backButtonCallback
- The listener which handles the back button presspublic void isCallUiOpen(@NonNull IUnbluApiSuccessCallback<java.lang.Boolean> success, @Nullable IUnbluApiNotInitializedExceptionCallback failure)
isCallActive(IUnbluApiSuccessCallback, IUnbluApiNotInitializedExceptionCallback)
function.isCallUiOpen
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
success
- Optional callback that will be called with the result if the UI is open or notfailure
- Optional callback that will be called if the api was not initializedpublic void showUi(boolean show, @Nullable IUnbluApiSuccessVoidCallback success, @Nullable IUnbluShowUiExceptionCallback failure)
show
- True to show the UI. False to hide it.success
- Called after the UI is shown/hidden. Triggered after the animation.failure
- Called if there is an issue showing the UIpublic void showUi(boolean show, boolean animate, @Nullable IUnbluApiSuccessVoidCallback success, @Nullable IUnbluShowUiExceptionCallback failure)
showUi
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
show
- True to show the UI. False to hide it.animate
- True to animation the show/hide of the UI.success
- Called after the UI is shown/hidden. Triggered after the animation.failure
- Called if there is an issue showing the UIpublic boolean isUiVisible()
isUiVisible
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
public void setUiMargins(int top, int bottom)
setUiMargins
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
top
- The amount of margin in pixel at the topbottom
- The amount of margin in pixel at the bottompublic int getUiTopMargin()
getUiTopMargin
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
public int getUiBottomMargin()
getUiBottomMargin
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
public void openConversation(@NonNull java.lang.String conversationId, @Nullable IUnbluApiSuccessVoidCallback success, @Nullable IUnbluApiOpenConversationExceptionCallback failure)
showUi(boolean, IUnbluApiSuccessVoidCallback, IUnbluShowUiExceptionCallback)
(wait for the success callback).openConversation
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
conversationId
- The id of the conversation which should be opened.success
- Called after the conversation was openedfailure
- Called if there was an error opening the conversationpublic void startAudioCall(@NonNull java.lang.String conversationId, @Nullable IUnbluApiSuccessVoidCallback success, @Nullable IUnbluApiStartAudioCallExceptionCallback failure)
showUi(boolean, IUnbluApiSuccessVoidCallback, IUnbluShowUiExceptionCallback)
(wait for the success callback).startAudioCall
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
conversationId
- The id of the conversation in which the audio call should be startedsuccess
- Called after the conversation was opened and the call has been startedfailure
- Called if there was an error opening the conversation and starting the callpublic void startVideoCall(@NonNull java.lang.String conversationId, @Nullable IUnbluApiSuccessVoidCallback success, @Nullable IUnbluApiStartVideoCallExceptionCallback failure)
showUi(boolean, IUnbluApiSuccessVoidCallback, IUnbluShowUiExceptionCallback)
(wait for the success callback).startVideoCall
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
conversationId
- The id of the conversation in which the video call should be started.success
- Called after the conversation was opened and the call has been startedfailure
- Called if there was an error opening the conversation and starting the callpublic void openConversationOverview(@Nullable IUnbluApiSuccessVoidCallback success, @Nullable IUnbluApiOpenConversationOverviewExceptionCallback failure)
showUi(boolean, IUnbluApiSuccessVoidCallback, IUnbluShowUiExceptionCallback)
(wait for the success callback).openConversationOverview
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
success
- Called when the overview was openedfailure
- Called if there was an error opening the overviewpublic java.lang.String getOpenConversationId()
getOpenConversationId
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
java.lang.IllegalStateException
- if the API is not initialized or if the UI was never shown.public void isCallActive(@Nullable IUnbluApiSuccessCallback<java.lang.Boolean> success, @Nullable IUnbluApiNotInitializedExceptionCallback failure)
isCallActive
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
success
- Called with the state of a callfailure
- Called if the api was not initialized firstpublic int getUnreadMessagesCount()
getUnreadMessagesCount
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
public PersonInfo getPersonInfo()
getPersonInfo
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
java.lang.IllegalStateException
- if the API is not initializedUnsupportedCollaborationServerVersionException
- if the used collaboration server is not of version 5.x newer than 5.17 or newer than 6.3public boolean isMobileCoBrowsingActive()
isMobileCoBrowsingActive
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
UnsupportedCollaborationServerVersionException
- if the used collaboration server is not of version 5.x newer than 5.17 or newer than 6.3public void stopMobileCoBrowsing(@Nullable IUnbluApiSuccessVoidCallback success, @Nullable IUnbluApiStopMobileCoBrowsingExceptionCallback failure)
stopMobileCoBrowsing
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
success
- if mobile co-browsing was successfully stopped or if it was not activefailure
- if stopping mobile co-browsing failedUnsupportedCollaborationServerVersionException
- if the used collaboration server is not of version 5.x newer than 5.17 or newer than 6.3public void setScreenCapturer(@NonNull com.unblu.coresdk.internal.module.capturing.IScreenCapturer screenCapturer)
setScreenCapturer
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
screenCapturer
- The IScreenCapturer
class which must implement it.public void setCustomLoadingViewCreator(@Nullable IUnbluCustomLoadingViewCreator customLoadingViewCreator)
setCustomLoadingViewCreator
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>
customLoadingViewCreator
- The loading view creator which should be used whenever a loading view is displayed@Nullable public IUnbluCustomLoadingViewCreator getCustomLoadingViewCreator()
getCustomLoadingViewCreator
in class com.unblu.coresdk.internal.InternalUnbluCoreApi<T extends com.unblu.coresdk.internal.IUnbluCoreApiDelegate>