Documentation
¶
Overview ¶
Package backgroundlocation keeps following the phone after the person leaves your app: a delivery, a run, a trip. It runs where they can see it, with a notification on Android and the location indicator on iOS, so it needs no "always allow" permission. Start it from a screen on show.
nimbus native plugin add background-location
if ok, _ := backgroundlocation.Request(ctx); ok {
backgroundlocation.Start(ctx, backgroundlocation.Options{Title: "Trip running", MinDistance: 25})
}
points, err := backgroundlocation.Points(ctx)
backgroundlocation.Stop(ctx)
To notice when someone arrives somewhere, geofencing does that with far less battery.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Start ¶
Start begins following, until Stop. Call it from a screen on show: both systems refuse to begin from the background. Without permission it fails with plugin.Denied.
Types ¶
type Options ¶
type Options struct {
Title string `json:"title,omitempty"` // Android's notification heading
Text string `json:"text,omitempty"` // Android's notification text
MinDistance float64 `json:"minDistance,omitempty"` // metres to move before the next point; 0 means 10
}
Options say how to follow.
type Point ¶
type Point struct {
Latitude float64 `json:"latitude"` // in degrees
Longitude float64 `json:"longitude"` // in degrees
Accuracy float64 `json:"accuracy"` // metres
Speed float64 `json:"speed"` // metres a second; below 0 when unknown
At time.Time `json:"-"` // when it was there
Time float64 `json:"time"` // the same, in seconds since 1970
}
Point is one place it passed.
Click to show internal directories.
Click to hide internal directories.