Skip to main content
←API Reference ←com.nianticspatial.nsdk.helpers

createLiveDataSource


Declaration​

fun createLiveDataSource( context: Context, frameProvider: () -> Frame?, orientationProvider: () -> Orientation, captureDepth: Boolean = false ): NsdkSessionDataSource

Summary​

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 or
Fragment'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, and
starts on its own once it is granted; with only approximate location it stays off and logs a
warning.

Parameters​

NameTypeSummary
contextContext
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.
captureDepthBoolean
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.