Here's a list of all the functions supported by the UserView Android SDK.
Connection Management
| Function | Description |
|---|
connect() | Establishes a WebSocket connection to the servers. |
disconnect() | Closes the connection temporarily without ending the session. |
reset() | Resets the connection state and reconnects if previously connected. |
cleanup(keepSessionAlive: Boolean) | Cleans up resources. Set keepSessionAlive to true to allow reconnection. |
Session Control
| Function | Description |
|---|
stopSession() | Ends the current screen sharing session. |
declineSession() | Declines an incoming session request. |
customMessage(message: String) | Sends a custom text or JSON message to the agent. |
Updating Connection Properties
Use updateConnection() to update visitor identification after initialization:
UpscopeManager.shared?.updateConnection(
agentPrompt = "VIP Customer",
integrationIds = listOf("zendesk:12345"),
identities = listOf("John Smith", "john@example.com"),
uniqueId = "user-123",
metadata = mapOf("plan" to "enterprise", "region" to "US")
)
Clearing Values
To clear a value, pass null. To keep existing values unchanged, omit the parameter.
// Clear the agent prompt, keep everything else
UpscopeManager.shared?.updateConnection(agentPrompt = null)
State Subscriptions
Subscribe to real-time state changes:
// Connection status
UpscopeManager.shared?.subscribeToIsConnected { isConnected ->
println("Connected: $isConnected")
}
// Connecting status
UpscopeManager.shared?.subscribeToIsConnecting { isConnecting ->
println("Connecting: $isConnecting")
}
// Screen capture active
UpscopeManager.shared?.subscribeToIsRecording { isRecording ->
println("Recording: $isRecording")
}
// Short ID changes
UpscopeManager.shared?.subscribeToShortId { shortId ->
println("Short ID: $shortId")
}
// Lookup code changes
UpscopeManager.shared?.subscribeToLookupCode { code ->
println("Lookup code: $code")
}
// Connection ID changes
UpscopeManager.shared?.subscribeToUniqueConnectionId { connectionId ->
println("Connection ID: $connectionId")
}
Activity Management
| Function | Description |
|---|
setupWithActivity(activity: FragmentActivity) | Binds the SDK to an activity for screen capture. |
bindToActivity(activity: Activity) | Explicitly binds to a specific activity. |
bindToActivityContaining(view: View) | Binds to the activity containing the specified view. |
getCurrentInstanceActivity() | Returns the currently bound activity. |
refreshInstanceActivityBinding() | Forces a refresh of the activity binding. |
Redaction Control
| Property/Function | Description |
|---|
redactionEnabled | Boolean to enable/disable redaction globally. Default: true. |
registerRedactionMiddleware(middleware) | Registers custom coordinate-based redaction. |
registerFlutterRedactionCallback(callback) | Registers an async callback for Flutter redaction. |
registerFrameCaptureMiddleware(middleware) | Controls when frames are captured. |
Logging
| Property | Description |
|---|
enableLogging | Set to true to enable SDK logs. Default: false. |
showDebugLogs | Set to true for detailed debug logging. |
Configuration
| Function | Description |
|---|
refreshConfiguration() | Forces a fetch of configuration from the server. |