createLiveDataSource
Declaration
fun createLiveDataSource( context: Context, frameProvider: () -> Frame?, orientationProvider: () -> Orientation, captureDepth: Boolean = false ): NsdkSessionDataSource
Summary
Parameters
| Name | Type | Summary |
|---|---|---|
| context | Context | Application or Activity context (for sensor and location access). |
| frameProvider | () -> Frame? | Returns the latest ARCore [Frame]. Called by [NsdkSessionDataSource.prepareFrame]. |
| orientationProvider | () -> Orientation | Returns the current device screen orientation. |
| captureDepth | Boolean | When true, each frame also snapshots the ARCore depth image (Depth API) so platform depth reaches the native layer. Enable together with useLidar on the session and Config.DepthMode.AUTOMATIC on the ARCore session. |
Creates a live ARCore data source that manages GPS and compass sensors internally.
The returned object also implements
DefaultLifecycleObserver: add it to your Activity's orFragment's lifecycle. The compass starts on resume, so without a lifecycle it reports no
samples; GPS and compass stop on pause and destroy. GPS needs
ACCESS_FINE_LOCATION, andstarts on its own once it is granted; with only approximate location it stays off and logs a
warning.