public class UnbluAgentApi
extends com.unblu.sdk.agent.internal.InternalUnbluAgentApi
Before using the API, ensure that in your app manifest file points you use either the class UnbluAgentApplication
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(UnbluApiConfiguration)
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)
{
UnbluAgentApi
.getInstance()
.UnbluCoreApi.configureApi(UnbluApiConfiguration)
//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.
UnbluAgentApi
.getInstance()
.UnbluCoreApi.initApi(IUnbluApiSuccessfullyInitializedCallback, IUnbluApiInitializeExceptionCallback)
(success: {<success handling>}, failure: {<error handling>}))
...
}
showUnblUi {
//the unblu UI should be shown
UnbluAgentApi
.UnbluCoreApi.showUi(boolean, IUnbluApiSuccessVoidCallback, IUnbluShowUiExceptionCallback)
(true, success: {<success handling>}, failure: {<error handling>});
}
ANIMATION_TIME, enableCapturingPerformanceLogging, enableDebugOutput
Modifier and Type | Method and Description |
---|---|
void |
configureApi(UnbluApiConfiguration configuration)
Configures the unblu api.
|
protected void |
destroy() |
static UnbluAgentApi |
getInstance() |
deinitApi, getApplication, getCustomLoadingViewCreator, getLogLevel, getNotificationApi, getOpenConversationId, getPersonInfo, getUiBottomMargin, getUiTopMargin, getUnreadMessagesCount, initApi, initApi, internalGetCoreInstance, isCallUiOpen, isInErrorState, isInitialized, isUiVisible, openConversation, openConversationOverview, preloadUi, setApplicationContext, setAutoHideUiOnBack, setBackButtonCallback, setCustomBackgroundColor, setCustomCookies, setCustomLoadingViewCreator, setLogLevel, setNamedArea, setUiMargins, showUi, showUi, startAudioCall, startVideoCall
@NonNull public static UnbluAgentApi getInstance()
UnbluAgentApi
. Only for internal use!protected void destroy()
destroy
in class com.unblu.sdk.core.internal.InternalUnbluCoreApi<com.unblu.sdk.agent.internal.AgentApiDelegate>
public void configureApi(@NonNull UnbluApiConfiguration configuration)
UnbluCoreApi.initApi(IUnbluApiSuccessfullyInitializedCallback, IUnbluApiInitializeExceptionCallback)
to be able start new sessions and use other API features.
Note:
configureApi
in class com.unblu.sdk.agent.internal.InternalUnbluAgentApi
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.