Skip to navigation

Client (object)

Android SDK v3 API reference
View as Markdown

com.voximplant.android.sdk.core

Interface that connects, logs in, and manages push notifications tokens.

Methods

connect

fun connect(options: ConnectOptions, callback: ConnectionCallback): Unit

Connects to the Voximplant cloud.

Parameters

ParameterTypeRequirementDescription
optionsConnectOptionsConnect options
callbackConnectionCallbackObject to receive the result of this operation

Returns: Unit

disconnect

fun disconnect(): Unit

Closes the connection with the Voximplant Cloud.

If this method is called while client is disconnected, ClientSessionListener.onConnectionClosed is triggered with DisconnectReason.AlreadyDisconnected reason.

Returns: Unit

handlePushNotification

fun handlePushNotification(notification: Map<String, String>): Unit

Handles an incoming push notification.

Parameters

ParameterTypeRequirementDescription
notificationMap<String, String>Incoming push notification that comes from FirebaseMessagingService.onMessageReceived(RemoteMessage remoteMessage)

Returns: Unit

login

fun login(username: String, password: String, callback: LoginCallback): Unit

Logs in to the specified Voximplant application with password.

Parameters

ParameterTypeRequirementDescription
usernameStringFull user name, including app and account name, like someuser@someapp.youraccount.voximplant.com
passwordStringUser password
callbackLoginCallback

Returns: Unit

loginWithAccessToken

fun loginWithAccessToken(username: String, accessToken: String, callback: LoginCallback): Unit

Performs login via the specified username and access token that has been obtained in LoginCallback.onSuccess callback before.

Parameters

ParameterTypeRequirementDescription
usernameStringFull user name, including app and account name, like someuser@someapp.youraccount.voximplant.com
accessTokenStringAccess token that is obtained in onLoginSuccessful callback
callbackLoginCallback

Returns: Unit

loginWithOneTimeKey

fun loginWithOneTimeKey(username: String, hash: String, callback: LoginCallback): Unit

Performs login via one time key that has been generated before.

Check this article for details.

Parameters

username

Type: String

Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com

hash

Type: String

Hash that is generated via the following formula: MD5(oneTimeKey+"|"+MD5(user+":voximplant.com:"+password))

Please note that here user is just a user name, without app name, account name or anything else after ”@”.

callback

Type: LoginCallback

Returns: Unit

refreshToken

fun refreshToken(username: String, refreshToken: String, callback: RefreshTokenCallback): Unit

Performs refresh of login tokens required for login via access token.

Parameters

ParameterTypeRequirementDescription
usernameStringFull user name, including app and account name, like someuser@someapp.youraccount.voximplant.com
refreshTokenStringRefresh token that is obtained in onLoginSuccessful callback
callbackRefreshTokenCallback

Returns: Unit

registerForPushNotifications

fun registerForPushNotifications(pushConfig: PushConfig, callback: RegisterPushTokenCallback?): Unit

Registers for push notifications. Application can receive push notifications from Voximplant Server after first log in.

The API may be called in any client state, but the push token is registered only after login successful.

Parameters

ParameterTypeRequirementDescription
pushConfigPushConfigPush token configuration
callbackRegisterPushTokenCallback?Object to receive the result of this operation

Returns: Unit

requestOneTimeKey

fun requestOneTimeKey(username: String, callback: GenerateOneTimeKeyCallback): Unit

Generates one time login key for automated login process.

Check this article for details.

Parameters

ParameterTypeRequirementDescription
usernameStringFull user name, including app and account name, like someuser@someapp.youraccount.voximplant.com
callbackGenerateOneTimeKeyCallback

Returns: Unit

setClientSessionListener

fun setClientSessionListener(listener: ClientSessionListener?): Unit

Sets the ClientSessionListener listener to handle events related to the connection with the Voximplant Cloud.

Parameters

ParameterTypeRequirementDescription
listenerClientSessionListener?ClientSessionListener listener or null. If null, any previously set listener is removed.

Returns: Unit

unregisterFromPushNotifications

fun unregisterFromPushNotifications(pushConfig: PushConfig, callback: RegisterPushTokenCallback?): Unit

Unregisters from push notifications. Application can no longer receive push notifications from the Voximplant server.

The API may be called in any Client state, but the push token is unregistered only after a successful login.

Parameters

ParameterTypeRequirementDescription
pushConfigPushConfigConfiguration for push notifications including push token and bundle id
callbackRegisterPushTokenCallback?Object to receive the result of this operation

Returns: Unit

Properties

clientState

val clientState: ClientState

Gets the current client state.

Read-only.

displayName

val displayName: String?

Gets the current user’s display name. Display name is available only when the user is logged in, otherwise the property returns null.

Read-only.