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

LocationHelper


Declaration​

class LocationHelper

Summary​

Subscribes to GPS updates via the Fused Location Provider and notifies an [OnUpdateListener] on each new fix. Used internally by [DefaultSessionDataSource].


Constructors​

constructor(context: Context, listener: OnUpdateListener)

Parameters​

NameTypeSummary
contextContext
-
listenerOnUpdateListener
-

Functions​

NameTypeSummary
hasLocationPermissionsBoolean
Returns true if [ACCESS_FINE_LOCATION][android.Manifest.permission.ACCESS_FINE_LOCATION] is granted.
startLocationUpdatesvoid
Begins receiving GPS updates. Delivers the last known location immediately (if available),
then streams new fixes at ~5-second intervals via [OnUpdateListener.onLocationUpdate].
Requires [ACCESS_FINE_LOCATION][android.Manifest.permission.ACCESS_FINE_LOCATION]; no-op
without it, logging a warning once if only approximate location is granted. NSDK's
localization needs precise fixes: an approximate one is blurred to an area kilometres
across. No-op while already started, so it can be called again (for example from every
onResume) without registering a second subscription.
stopLocationUpdatesvoid
Stops receiving GPS updates. Safe to call even if [startLocationUpdates] was never called.