Android SDK API Reference
Captur Micromobility Events Android SDK API Reference
This reference describes the public API surface for integrating the Captur Micromobility Events SDK into an Android app.
Package
Primary API package:
com.captur.capturmicromobility.pblic
Camera analytics enum:
com.captur.capturmicromobility.events.CapturCameraType
Captur (object)
com.captur.capturmicromobility.pblic.Captur
Central entry point for initialization and model preparation.
init
fun init(context: Context, apiKey: String)- Initializes the SDK, analytics, and storage.
- Must be called before any other Captur API.
setTimeout
@Throws(CapturException::class)
fun setTimeout(value: Int)- Sets the realtime capture timeout in seconds (default: 7).
- Used by
CapturCameraManagerwhen determining the timeout window. valuemust be > 1 and >setDelayvalue
setDelay
@Throws(CapturException::class)
fun setDelay(value: Int)- Sets the delay window in seconds before realtime processing begins (default: 1).
valuemust be > 0 and <setTimeoutvalue.
prepareModel
fun prepareModel(
locationName: String?,
assetType: CapturAssetType,
latitude: Double?,
longitude: Double?,
callback: (Boolean, CapturError?) -> Unit
)- Fetches configuration, downloads/updates the model, and initializes it on-device.
- Required before any realtime predictions.
getConfig
fun getConfig(
locationName: String?,
assetType: CapturAssetType,
latitude: Double?,
longitude: Double?,
callback: (Boolean, CapturError?) -> Unit
)- Fetches configuration for the stored location and asset type.
- Requires a successful
prepareModel()call beforehand.
getEtag
@Throws(CapturError::class)
fun getEtag(): String- Returns the etag for the currently prepared model.
- Throws
CapturErrorif called beforeprepareModel()succeeds.
CapturCameraManager
com.captur.capturmicromobility.pblic.CapturCameraManager
Handles realtime capture flow and decisions.
Constructor
class CapturCameraManager(referenceId: String)referenceIdis a session/attempt identifier (e.g., trip ID).- Creating a new instance starts a realtime session automatically.
subscribeToEvents
fun subscribeToEvents(events: CapturEvents)- Registers callbacks for decisions, guidance, and errors.
- Callbacks are delivered on the main thread.
retake
fun retake()- Starts a new attempt within the current session.
endAttempt
fun endAttempt()- Forces the current attempt to end and produces a final decision if available.
cameraErrorEvent
fun cameraErrorEvent(error: CapturError)- Forwards camera errors to the SDK event stream.
Camera Composables
com.captur.capturmicromobility.camera
CapturCameraPreview
@Composable
fun CapturCameraPreview(
flashLightOn: Boolean = false,
zoomState: Boolean = false,
system: CapturCameraManager,
modifier: Modifier = Modifier.fillMaxSize(),
)- Toggles torch and zoom (1x/2x) and reports camera analytics as
REGULAR.
CapturUltraWideCamera
@Composable
fun CapturUltraWideCamera(
flashLightOn: Boolean = false,
system: CapturCameraManager,
ultraWideState: Boolean = false,
modifier: Modifier = Modifier.fillMaxSize(),
)- Uses the ultrawide back camera when available; otherwise falls back to the standard back camera.
- Toggles torch and reports camera analytics as
ULTRAWIDE(orREGULARwhen not available).
CapturEvents
com.captur.capturmicromobility.pblic.events.CapturEvents
interface CapturEvents {
fun capturDidGenerateEvent(state: CapturCameraState, metadata: CapturOutput?)
fun capturDidGenerateError(error: CapturError)
fun capturDidGenerateGuidance(metadata: CapturOutput)
}Event flow:
CAMERA_RUNNINGis emitted when realtime capture starts.CAMERA_DECIDEDis emitted when a decision is reached or when the attempt times out.capturDidGenerateGuidanceis emitted for guidance events (e.g., insufficient information).
Models
CapturAssetType
com.captur.capturmicromobility.pblic.models.CapturAssetType
Values:
E_BIKEE_SCOOTERSEATED_E_SCOOTERMINI_E_BIKEPACKAGE
CapturDecision
com.captur.capturmicromobility.pblic.models.CapturDecision
Values:
GOOD_PARKINGGOOD_DELIVERYIMPROVABLE_PARKINGIMPROVABLE_DELIVERYBAD_PARKINGBAD_DELIVERYINSUFFICIENT_INFORMATIONNO_DECISION_MAP_DETECTED
CapturCameraState
com.captur.capturmicromobility.pblic.models.CapturCameraState
Values:
CAMERA_RUNNINGCAMERA_DECIDED
CapturOutput
com.captur.capturmicromobility.pblic.models.CapturOutput
Fields:
decision:CapturDecisionreason: StringguidanceTitle: String?guidanceDetail: String?decisionTitle: String?decisionDetail: String?image:Bitmap?
CapturError
com.captur.capturmicromobility.pblic.error.CapturError
Error types:
LOCATION_NAME_EMPTYSERIALIZATION_ERRORMODEL_VERIFICATION_FAILEDMODEL_INITIALIZATION_FAILEDMODEL_UNAVAILABLESERVER_ERRORUNKNOWN_ERRORMODEL_DOES_NOT_EXIST_ON_DEVICE
CapturCameraType
com.captur.capturmicromobility.events.CapturCameraType
Values:
REGULARULTRAWIDE
Permissions
android.permission.CAMERAis required; the SDK declares it and your app must request it at runtime.android.permission.INTERNETis required for config and model downloads (declare in your app manifest).
Updated 11 days ago
