RoomioScanSession
class RoomioScanSession
A single scan, from starting the camera to exporting the result.
Create a session with Roomio.startScan and bind it to a RoomioScanView. Call start to begin recording; the view's own buttons let the user finish or exit the scan. Follow it through state and events, then call export once it is RoomioScanState.Finished.
Types
Properties
| Name | Summary |
|---|---|
| events | val events: SharedFlow<RoomioScanEvent> Notifications from the scan, such as tracking changes and progress. Past events are not replayed, so start collecting before calling start. |
| isShowingDialog | val isShowingDialog: StateFlow<Boolean> Whether RoomioScanView is showing a sheet or dialog: a device check before the scan, the exit confirmation, saying the scan failed or couldn't be saved, or an ARCore problem. Hide your own controls while it is. |
| isShowingOnboarding | val isShowingOnboarding: StateFlow<Boolean> Whether RoomioScanView is showing the onboarding before the scan. Hide your own controls while it is; it ends when the user finishes or skips it, and the camera starts then. Turn it off with RoomioScanConfig.showsOnboarding. |
| scanId | val scanId: String? Identifies the scan; quote it when contacting Roomio about it. Null until start. |
| state | val state: StateFlow<RoomioScanState> The current state of the scan. |
Functions
| Name | Summary |
|---|---|
| cancel | fun cancel() Abandon the scan without saving it. state moves to RoomioScanState.Cancelled; call close afterwards. RoomioScanView calls this when the user confirms they want to exit, or leaves a sheet shown before the scan. |
| close | fun close() Discard the session and release the camera, and delete the scan's working files. An exported RoomioBundle is kept. The session is unusable afterwards. |
| export | suspend fun export(): RoomioBundle Package the finished scan for upload. Call once state is RoomioScanState.Finished, which comes a few seconds after stop while the scan saves. This is a suspending function, so call it from a coroutine. |
| pause | fun pause() Pause the scan until resume. The scan also pauses by itself when the app goes to the background, and resumes by itself when the app returns. |
| resume | fun resume() Resume a scan paused with pause. |
| start | fun start() Start recording the scan. Call it when you show RoomioScanView: while the view shows the onboarding, recording begins once the user finishes or skips it. |
| stop | fun stop() Finish recording. Call export afterwards to get the result. |
Companion
object Companion
Properties
| Name | Summary |
|---|---|
| VERSION | val VERSION: String The version of the Roomio SDK. Same as Roomio.version. |
VERSION
The version of the Roomio SDK. Same as Roomio.version.
cancel
fun cancel()
Abandon the scan without saving it. state moves to RoomioScanState.Cancelled; call close afterwards. RoomioScanView calls this when the user confirms they want to exit, or leaves a sheet shown before the scan.
close
fun close()
Discard the session and release the camera, and delete the scan's working files. An exported RoomioBundle is kept. The session is unusable afterwards.
events
val events: SharedFlow<RoomioScanEvent>
Notifications from the scan, such as tracking changes and progress. Past events are not replayed, so start collecting before calling start.
export
suspend fun export(): RoomioBundle
Package the finished scan for upload. Call once state is RoomioScanState.Finished, which comes a few seconds after stop while the scan saves. This is a suspending function, so call it from a coroutine.
Throws
| RoomioError | with RoomioError.Code.EXPORT_FAILED if the scan cannot be packaged. Cancelling the coroutine throws a CancellationException as usual, not a RoomioError. |
isShowingDialog
val isShowingDialog: StateFlow<Boolean>
Whether RoomioScanView is showing a sheet or dialog: a device check before the scan, the exit confirmation, saying the scan failed or couldn't be saved, or an ARCore problem. Hide your own controls while it is.
isShowingOnboarding
val isShowingOnboarding: StateFlow<Boolean>
Whether RoomioScanView is showing the onboarding before the scan. Hide your own controls while it is; it ends when the user finishes or skips it, and the camera starts then. Turn it off with RoomioScanConfig.showsOnboarding.
pause
fun pause()
Pause the scan until resume. The scan also pauses by itself when the app goes to the background, and resumes by itself when the app returns.
resume
fun resume()
Resume a scan paused with pause.
scanId
Identifies the scan; quote it when contacting Roomio about it. Null until start.
start
fun start()
Start recording the scan. Call it when you show RoomioScanView: while the view shows the onboarding, recording begins once the user finishes or skips it.
While Battery Saver is on, the scan doesn't start: the view shows a sheet asking the user to turn it off, whose only button cancels the session, and events reports RoomioScanEvent.Failed with RoomioError.Code.POWER_SAVING. Likewise while the device is too low on storage (under 200 MB), with RoomioError.Code.INSUFFICIENT_STORAGE, and while the battery is at 25% or less, with RoomioError.Code.LOW_BATTERY. During a scan, each of them only shows a warning; the scan carries on.
When storage is low (under 3 GB) or the battery is under 50%, the view first asks the user whether to continue anyway. Continuing starts the scan; leaving moves state to RoomioScanState.Cancelled, as exiting does.
When camera access is refused, the view shows a sheet whose buttons open your app's page in Settings or cancel the session, and events reports RoomioScanEvent.Failed with RoomioError.Code.PERMISSION_DENIED. Once the user allows access and returns to your app, the sheet closes and the scan starts.
state
val state: StateFlow<RoomioScanState>
The current state of the scan.
stop
fun stop()
Finish recording. Call export afterwards to get the result.
Throws
| RoomioError | with RoomioError.Code.NOT_READY in the first few seconds of a scan. |