Documentation
¶
Index ¶
- type BinderClient
- func (c *BinderClient) CheckServiceExists(serviceName string) (bool, error)
- func (c *BinderClient) Close() error
- func (c *BinderClient) GetDeviceInfo() (*DeviceInfo, error)
- func (c *BinderClient) GetDisplayInfo() (*DisplayInfo, error)
- func (c *BinderClient) GetLastLocation(provider string) (*LocationResult, error)
- func (c *BinderClient) GetPowerStatus() (*PowerStatus, error)
- func (c *BinderClient) ListServicesJSON() (string, error)
- type DeviceInfo
- type DisplayInfo
- type LocationResult
- type PowerStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinderClient ¶
type BinderClient struct {
// contains filtered or unexported fields
}
BinderClient provides Java-friendly access to Android binder services. All exported methods use gomobile-safe types only.
func NewBinderClient ¶
func NewBinderClient() (*BinderClient, error)
NewBinderClient opens the binder driver, creates a version-aware transport, and initializes the service manager.
func (*BinderClient) CheckServiceExists ¶
func (c *BinderClient) CheckServiceExists(serviceName string) (bool, error)
CheckServiceExists checks whether a service is registered in the service manager.
func (*BinderClient) Close ¶
func (c *BinderClient) Close() error
Close releases the binder driver and all associated resources.
func (*BinderClient) GetDeviceInfo ¶
func (c *BinderClient) GetDeviceInfo() (*DeviceInfo, error)
GetDeviceInfo returns an aggregate snapshot of device state by querying the power manager, thermal service, and service manager.
func (*BinderClient) GetDisplayInfo ¶
func (c *BinderClient) GetDisplayInfo() (*DisplayInfo, error)
GetDisplayInfo returns the current display brightness (default constraint) and night mode state.
func (*BinderClient) GetLastLocation ¶
func (c *BinderClient) GetLastLocation( provider string, ) (*LocationResult, error)
GetLastLocation returns the last known location for the given provider (e.g. "gps", "network", "fused"). Returns nil with no error if no location is cached for that provider.
func (*BinderClient) GetPowerStatus ¶
func (c *BinderClient) GetPowerStatus() (*PowerStatus, error)
GetPowerStatus returns the current power state by querying the PowerManager service.
func (*BinderClient) ListServicesJSON ¶
func (c *BinderClient) ListServicesJSON() (string, error)
ListServicesJSON returns all registered binder service names as a JSON array of strings.
type DeviceInfo ¶
type DeviceInfo struct {
ScreenOn bool
PowerSave bool
Brightness float32
ThermalStatus int32
ServiceCount int32
}
DeviceInfo holds aggregate device state in gomobile-safe types.
type DisplayInfo ¶
DisplayInfo holds display state in gomobile-safe types.
type LocationResult ¶
type LocationResult struct {
Provider string
Lat float64
Lon float64
Alt float64
Speed float32
Bearing float32
Accuracy float32
TimeMs int64
}
LocationResult holds GPS location data in gomobile-safe types. All fields are exported primitives so gomobile can bridge them to Java.
type PowerStatus ¶
PowerStatus holds power state in gomobile-safe types.