geolocation

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package geolocation says where the phone is.

nimbus native plugin add geolocation

ok, err := geolocation.Request(ctx)
at, err := geolocation.Current(ctx)
go geolocation.Watch(ctx, func(p geolocation.Position) { setHere(p) })

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Request

func Request(ctx context.Context) (bool, error)

Request asks to use the location while the app is open, once.

func Watch

func Watch(ctx context.Context, f func(Position)) error

Watch calls f as the phone moves, until ctx ends. It blocks, so run it from a goroutine in an effect.

Types

type Position

type Position struct {
	Latitude  float64 `json:"latitude"`  // in degrees
	Longitude float64 `json:"longitude"` // in degrees
	Accuracy  float64 `json:"accuracy"`  // metres
	Altitude  float64 `json:"altitude"`  // metres
	Speed     float64 `json:"speed"`     // metres a second; below 0 when unknown
	Heading   float64 `json:"heading"`   // degrees from north; below 0 when unknown
}

Position is a place on Earth.

func Current

func Current(ctx context.Context) (Position, error)

Current returns a fresh position. Call Request first: without permission it fails with plugin.Denied.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL