class Sessions
The session service.
This class allows performing session related actions like establishing a new one, restoring a session that already exists, suspending it or disconnecting it when the session has to be ended. It also allows adding a listener to receive the session state (@see SessionsListener).
val currentState: State
Current session state. |
|
val rx: SessionsRx
Access to the reactive API of the service. |
|
val sessionId: String?
Session identifier in the signaling server. |
|
val username: String?
Username of the current user when the session is connected. If the session is still not connected, value will be null. |
fun addListener(listener: SessionsListener): Unit
Adds a listener to receive session state events. |
|
fun canRestoreSession(context: Context): Boolean
Checks if there is enough information to restore the session. |
|
fun connect(authentication: Authentication, context: Context): Unit
Connects a new session. |
|
fun disconnect(context: Context): Unit
Destroys the active session established against the server. IMPORTANT: After invoking this method, the session will be no longer active and a new SippoClient instance needs to be configured. |
|
fun fetchProviders(onComplete: (Either<List<Map<String, String>>, SippoResourceError>) -> Unit): Unit
Fetches the available providers. |
|
fun getLocalUser(onCompletion: (Either<User, SippoResourceError>) -> Unit): Unit
Retrieves the information of the local user. |
|
fun isPermissionGranted(permission: Permission): Boolean
Checks if a permission is granted for the user in the current session. |
|
fun removeListener(listener: SessionsListener): Unit
Removes the specified listener. |
|
fun restore(context: Context): Unit
Restores the active session. |
|
fun setPushToken(context: Context, token: String): Unit
Sets a new Firebase token to receive push notifications from the server. |
|
fun suspend(): Unit
Suspends the active session. It should be called when the application goes to background. |
|
fun updateLocalUser(user: User, onCompletion: (Either<User, SippoResourceError>) -> Unit): Unit
Updates de local user. |