HomeSDK IntegrationDiscussions
Log In
SDK Integration

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 CapturCameraManager when determining the timeout window.
  • value must be > 1 and > setDelay value

setDelay

@Throws(CapturException::class)
fun setDelay(value: Int)
  • Sets the delay window in seconds before realtime processing begins (default: 1).
  • value must be > 0 and < setTimeout value.

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 CapturError if called before prepareModel() succeeds.

CapturCameraManager

com.captur.capturmicromobility.pblic.CapturCameraManager

Handles realtime capture flow and decisions.

Constructor

class CapturCameraManager(referenceId: String)
  • referenceId is 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 (or REGULAR when 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_RUNNING is emitted when realtime capture starts.
  • CAMERA_DECIDED is emitted when a decision is reached or when the attempt times out.
  • capturDidGenerateGuidance is emitted for guidance events (e.g., insufficient information).

Models

CapturAssetType

com.captur.capturmicromobility.pblic.models.CapturAssetType

Values:

  • E_BIKE
  • E_SCOOTER
  • SEATED_E_SCOOTER
  • MINI_E_BIKE
  • PACKAGE

CapturDecision

com.captur.capturmicromobility.pblic.models.CapturDecision

Values:

  • GOOD_PARKING
  • GOOD_DELIVERY
  • IMPROVABLE_PARKING
  • IMPROVABLE_DELIVERY
  • BAD_PARKING
  • BAD_DELIVERY
  • INSUFFICIENT_INFORMATION
  • NO_DECISION_MAP_DETECTED

CapturCameraState

com.captur.capturmicromobility.pblic.models.CapturCameraState

Values:

  • CAMERA_RUNNING
  • CAMERA_DECIDED

CapturOutput

com.captur.capturmicromobility.pblic.models.CapturOutput

Fields:

  • decision: CapturDecision
  • reason: String
  • guidanceTitle: String?
  • guidanceDetail: String?
  • decisionTitle: String?
  • decisionDetail: String?
  • image: Bitmap?

CapturError

com.captur.capturmicromobility.pblic.error.CapturError

Error types:

  • LOCATION_NAME_EMPTY
  • SERIALIZATION_ERROR
  • MODEL_VERIFICATION_FAILED
  • MODEL_INITIALIZATION_FAILED
  • MODEL_UNAVAILABLE
  • SERVER_ERROR
  • UNKNOWN_ERROR
  • MODEL_DOES_NOT_EXIST_ON_DEVICE

CapturCameraType

com.captur.capturmicromobility.events.CapturCameraType

Values:

  • REGULAR
  • ULTRAWIDE

Permissions

  • android.permission.CAMERA is required; the SDK declares it and your app must request it at runtime.
  • android.permission.INTERNET is required for config and model downloads (declare in your app manifest).