beginPolling

suspend fun beginPolling(lifecycle: Lifecycle, ticker: FrameTicker = ChoreographerFrameTicker)

Begin polling the CommandQueue for messages from the CommandServer. Without this, callbacks and errors will not be delivered. This should typically be called by tying to the lifecycle scope of the containing activity, fragment, or composable, e.g. with lifecycleScope.launch.

The polling will automatically start and stop based on the lifecycle state, only polling when the lifecycle is in the RESUMED state and while this CommandQueue has not been disposed.

Parameters

lifecycle

The lifecycle bounding the polling.

ticker

The frame ticker to use for polling. Defaults to ChoreographerFrameTicker, which uses the Choreographer to sync to the display refresh rate.

Throws

If the CommandQueue has been released.