Roomio
object Roomio
Entry point for the Roomio SDK.
Configure the SDK once at startup, check the device can scan, then start a scan.
Roomio.configure(context, publishableKey = "roomio_pub_live_…")
if (Roomio.isSupported(context) != RoomioSupport.UNSUPPORTED) {
val session = Roomio.startScan(activity)
}
Properties
Functions
| Name | Summary |
|---|---|
| configure | fun configure(context: Context, publishableKey: String) Configure the SDK with your publishable key. Call once, before any other SDK method, for example from your Application.onCreate. |
| exportDiagnostics | suspend fun exportDiagnostics(context: Context, scanId: String? = null): File Package the SDK's recent diagnostics into an encrypted file to send to Roomio support, including scans that crashed or never exported. Covers recent scans, or only scanId when given, and the calls your app made into the SDK. Only Roomio can read the file. This is a suspending function, so call it from a coroutine. |
| flush | fun flush() Send any waiting reports now, in the background. The SDK already sends them when it starts and after each scan, so you rarely need this. Does nothing while a scan is recording. |
| isSupported | fun isSupported(context: Context): RoomioSupport Whether this device can scan. Call before offering a scan, and hide the option on devices that return RoomioSupport.UNSUPPORTED. |
| isWorkerProcess | fun isWorkerProcess(): Boolean Whether this is the separate process scans use, which runs your Application.onCreate again. Return early there: the scan needs none of your app's setup. |
| setDiagnosticsListener | fun setDiagnosticsListener(listener: RoomioDiagnosticsListener?, minimumLevel: RoomioDiagnosticLevel = RoomioDiagnosticLevel.INFO) Receive the SDK's diagnostic messages at minimumLevel and above, for example to forward to your own logging. Pass null to stop. Messages arrive on the main thread. Errors also go to Logcat, tagged Roomio, with or without a listener. |
| startScan | fun startScan(activity: ComponentActivity, config: RoomioScanConfig = RoomioScanConfig()): RoomioScanSession Create a session for a new scan. |
configure
fun configure(context: Context, publishableKey: String)
Configure the SDK with your publishable key. Call once, before any other SDK method, for example from your Application.onCreate.
The publishable key identifies your organisation. It is safe to include in your app. The SDK uses it to fetch its configuration from Roomio in the background from time to time. The first scan after your app is installed or updated needs that to have happened once; after that, scanning works offline. It also sends Roomio reports of how scans went, with the errors and crashes behind them, when the SDK starts and after each scan. Nothing in them identifies your users.
Scans also use a separate process of your app, which runs Application.onCreate again. This does nothing there.
exportDiagnostics
suspend fun exportDiagnostics(context: Context, scanId: String? = null): File
Package the SDK's recent diagnostics into an encrypted file to send to Roomio support, including scans that crashed or never exported. Covers recent scans, or only scanId when given, and the calls your app made into the SDK. Only Roomio can read the file. This is a suspending function, so call it from a coroutine.
Parameters
androidJvm
| scanId | The scan to include, from RoomioScanSession.scanId; null includes every kept scan. |
Throws
| RoomioError | with RoomioError.Code.EXPORT_FAILED if the diagnostics cannot be packaged. |
flush
fun flush()
Send any waiting reports now, in the background. The SDK already sends them when it starts and after each scan, so you rarely need this. Does nothing while a scan is recording.
isSupported
fun isSupported(context: Context): RoomioSupport
Whether this device can scan. Call before offering a scan, and hide the option on devices that return RoomioSupport.UNSUPPORTED.
Scanning needs Google Play Services for AR (ARCore), which may be missing or outdated. Check again when your activity resumes: the answer changes once the user installs it.
isWorkerProcess
fun isWorkerProcess(): Boolean
Whether this is the separate process scans use, which runs your Application.onCreate again. Return early there: the scan needs none of your app's setup.
setDiagnosticsListener
fun setDiagnosticsListener(listener: RoomioDiagnosticsListener?, minimumLevel: RoomioDiagnosticLevel = RoomioDiagnosticLevel.INFO)
Receive the SDK's diagnostic messages at minimumLevel and above, for example to forward to your own logging. Pass null to stop. Messages arrive on the main thread. Errors also go to Logcat, tagged Roomio, with or without a listener.
startScan
fun startScan(activity: ComponentActivity, config: RoomioScanConfig = RoomioScanConfig()): RoomioScanSession
Create a session for a new scan.
The returned session is not recording yet: bind it to a RoomioScanView, then call RoomioScanSession.start. The SDK asks for camera access when the camera starts: when the onboarding ends, or when the scan screen resumes if there is no onboarding. It doesn't ask if your app already has access, so you can ask first to give your own explanation. If the user declines, the view shows a sheet that sends them to Settings, and RoomioScanSession.events reports RoomioScanEvent.Failed with RoomioError.Code.PERMISSION_DENIED; the scan starts once access is allowed, or the session is cancelled if the user cancels the sheet.
Parameters
androidJvm
| activity | The activity that hosts the scan. |
| config | Options for this scan. |
Throws
| RoomioError | RoomioError.Code.NOT_CONFIGURED if configure has not been called, RoomioError.Code.DEVICE_NOT_SUPPORTED if this device cannot scan, RoomioError.Code.CONNECTION_REQUIRED if the app hasn't been online since it was installed or updated, RoomioError.Code.PUBLISHABLE_KEY_REJECTED if Roomio didn't accept the publishable key, or RoomioError.Code.SDK_UPDATE_REQUIRED if this SDK version is no longer supported. |
version
The version of the Roomio SDK.