Documentation
¶
Overview ¶
Package geofencing notices when the phone enters or leaves a place, even while the app is in the background. Events wait on the phone until the app asks for them.
nimbus native plugin add geofencing
geofencing.Request(ctx)
geofencing.Add(ctx, geofencing.Region{ID: "cafe", Latitude: 18.53, Longitude: 73.89, Radius: 150})
go geofencing.Watch(ctx, func(e geofencing.Event) { greet(e) })
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct {
ID string `json:"id"` // the Region's ID
Enter bool `json:"enter"` // false: left
At time.Time `json:"-"` // when it happened
Time float64 `json:"time"` // seconds since 1970
}
Event is a crossing of a Region's edge.
type Region ¶
type Region struct {
ID string `json:"id"` // your name for it
Latitude float64 `json:"latitude"` // of the middle, in degrees
Longitude float64 `json:"longitude"` // of the middle, in degrees
Radius float64 `json:"radius"` // metres
}
Region is a circle on the map. Below about 100 metres it's unreliable.
Click to show internal directories.
Click to hide internal directories.