NSDKSession
Declaration
class NSDKSessionSummary
Creates a new NSDK instance with auth tokens or a configuration file. This is the primary entry point for initializing NSDK functionality. You must call this before using any other NSDK features. Only one [NSDKSession] may be active at a time. Creating a second instance while one is active will throw [IllegalStateException]. Call [close] on the existing session before creating a new one. The session and its feature sessions may be used from any thread. [close] waits for NSDK calls already running on other threads to return; after it, those calls fail or return empty results instead of touching the destroyed native instance.
Throws
IllegalStateException— if native libraries failed to load or a session is already active
Constructors
Constructor
Summary
Parameters
| Name | Type | Summary |
|---|---|---|
| configFilePath | String | - |
| logCallback | NsdkLogCallback? | - |
Overload 1
Summary
Creates a new NSDK instance from a programmatic configuration object.
Throws IllegalStateException if initialization fails.
Device metadata is automatically populated from Android platform APIs.
Create it on the main thread. The native creation methods carry @MainThread, but on private
members, so lint does not check callers; NSDK is only tested with the main thread here.
Parameters
| Name | Type | Summary |
|---|---|---|
| config | NsdkConfiguration.Configuration | - |
| pathConfig | PathConfig? | - |
Overload 2
Summary
Creates a new NSDK instance with an access token.
The token will be forwarded to native for validation and persistence.
Create it on the main thread. The native creation methods carry @MainThread, but on private
members, so lint does not check callers; NSDK is only tested with the main thread here.
Parameters
| Name | Type | Summary |
|---|---|---|
| accessToken | String | - |
| useLidar | Boolean | - |
| pathConfig | PathConfig? | - |
| logCallback | NsdkLogCallback? | - |
Properties
| Name | Type | Summary |
|---|---|---|
| dashcam | DashcamSession | - |
| dataSource | NsdkSessionDataSource? | The data source that supplies sensor samples to [update]. Assign a [NsdkSessionDataSource] before calling [update]. Set to null to release it. |
| depthSession | DepthSession | - |
| isAuthorized | Boolean | Indicates whether the ARDK session is authorized with valid tokens. Use this property to check if authentication is complete before making API calls that require authorization. You can poll this property to wait for token refresh to complete. Example usage: |
| mapping | DeviceMappingSession | - |
| mapStore | MappingStorageSession | - |
| meshDownload | MeshDownloaderSession | - |
| meshingSession | MeshingSession | - |
| playbackCache | PlaybackCacheSession | - |
| recordingExporter | RecordingExporter | - |
| scanning | ScanningSession | - |
| sceneSegmentation | SceneSegmentationSession | - |
| sites | SitesSession | - |
| vps2 | Vps2Session | - |
Functions
| Name | Type | Summary |
|---|---|---|
| close | void | Destroys an NSDK instance and any remaining opened feature sessions and frees associated resources. Must be called when the session is no longer needed. Its native resources are not freed any other way: a session that is garbage collected without [close] leaks them, and a new [NSDKSession] can then be created alongside it. Safe to call more than once and from any thread. Waits for NSDK calls running on other threads to return. Do not call it from the log callback or from inside another NSDK call. |
| disableTelemetry | void | Disables telemetry collection for this process. Clears any buffered telemetry events and stops accepting new ones. This is a process-wide operation. |
| getAccessAuthInfo | AuthInfo? | Gets access token authentication information. Returns authentication information containing information about the current access token. |
| getRefreshAuthInfo | AuthInfo? | Gets refresh token authentication information. Returns authentication information containing information about the current refresh token. |
| getRequestedDataFormats | Int | Gets the data formats that NSDK requires for processing. This function returns a bitmask indicating which types of input data (camera frames, depth, IMU, etc.) NSDK needs for optimal performance. Use this to configure your data capture pipeline accordingly. |
| getVersion | String | Returns the NSDK version string from the native library. |
| sendFrame | void | - |
| setAccessToken | void | Set the access token at runtime. Invalid/empty tokens are ignored by native. |
| setCallbackLogLevel | void | Sets the log level for callback logs. This function filters out logs of less severity than the specified level for the callback logger. |
| setFileLogLevel | void | Sets the log level for file logs. This function filters out logs of less severity than the specified level for the file logger. |
| setLogOutputPath | void | Sets the diagnostic output folder for log.txt, ardk_trace.log, and future VPS debugger files. No-op if the path is empty or unchanged. |
| setStdoutLogLevel | void | Sets the log level for stdout logs. This function filters out logs of less severity than the specified level for the stdout logger. |
| update | void | Pulls sensor samples from [dataSource] and submits a frame for native processing. No-op if [dataSource] is null or not ready. Call this once per camera frame. Because this is an expensive operation, consider throttling the calls if you notice degraded app performance. |
Creates a new NSDK instance from a JSON configuration file.
Throws IllegalStateException if initialization fails.
Create it on the main thread. The native creation methods carry
@MainThread, but on privatemembers, so lint does not check callers; NSDK is only tested with the main thread here.