Documentation
¶
Overview ¶
Package location reads the device's location once or continuously (Core Location on iOS, LocationManager on Android — no Google Play services needed).
loc, err := location.Current(a, location.Options{Accuracy: location.High})
stop, err := location.Watch(a, location.Options{}, func(l location.Location, err error) { ... })
defer stop()
Both ask for when-in-use permission first if the user was never asked; ErrPermissionDenied if refused. iOS needs NSLocationWhenInUseUsageDescription (permission "location"; returns ErrNotConfigured without it); Android needs ACCESS_FINE_LOCATION and/or ACCESS_COARSE_LOCATION. ErrNotAvailable means location services are off.
Functions return ErrUnsupported where the backend has no location and tango.ErrNotRunning after the app quit. On Android call Current from a goroutine, not from a main-thread callback.
Index ¶
Constants ¶
const ( Balanced = platform.AccuracyBalanced // ~100 m (default) High = platform.AccuracyHigh // best available, GPS Low = platform.AccuracyLow // ~kilometres )
Variables ¶
var ( ErrUnsupported = platform.ErrUnsupported ErrNotAvailable = platform.ErrNotAvailable ErrPermissionDenied = platform.ErrPermissionDenied ErrNotConfigured = platform.ErrNotConfigured )