androidutils

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: MIT Imports: 12 Imported by: 4

README

androidutils

GoDoc Build Status

Android utils for golang packages

LICENSE

MIT

Documentation

Index

Constants

View Source
const (
	BatteryStatusUnknown     = 1
	BatteryStatusCharging    = 2
	BatteryStatusDischarging = 3
	BatteryStatusNotCharging = 4
	BatteryStatusFull        = 5

	BatteryHealthUnknown            = 1
	BatteryHealthGood               = 2
	BatteryHealthOverheat           = 3
	BatteryHealthDead               = 4
	BatteryHealthOverVoltage        = 5
	BatteryHealthUnspecifiedFailure = 6
	BatteryHealthCold               = 7
)

Variables

View Source
var (
	ErrGetprop = errors.New("error call getprop")
)
View Source
var (
	ErrPackageNotExist = errors.New("package not exist")
)

Functions

func CachedProperty

func CachedProperty(name string) string

Return property by name from cache

func HWAddrWLAN

func HWAddrWLAN() (string, error)

func MemoryInfo

func MemoryInfo() (info map[string]int, err error)

MemoryInfo read from /proc/meminfo, unit kB

func Properties

func Properties() (props map[string]string, err error)

Properties extract info from $ adb shell getprop

func Property

func Property(name string) string

Return property by name

func Rotation

func Rotation() (rotation int, err error)

Rotation return degree of screen orientation. 0, 90, 180, 270

Types

type Battery

type Battery struct {
	ACPowered       bool   `json:"acPowered"`
	USBPowered      bool   `json:"usbPowered"`
	WirelessPowered bool   `json:"wirelessPowered"`
	Status          int    `json:"status"`
	Health          int    `json:"health"`
	Present         bool   `json:"present"`
	Level           int    `json:"level"`
	Scale           int    `json:"scale"`
	Voltage         int    `json:"voltage"`
	Temperature     int    `json:"temperature"`
	Technology      string `json:"technology"`
}

func (*Battery) StatusName

func (self *Battery) StatusName() string

func (*Battery) Update

func (self *Battery) Update() error

type Display

type Display struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

func WindowSize

func WindowSize() (display Display, err error)

WindowSize parse command "wm size" output command output example:

Physical size: 1440x2560
Override size: 1080x1920

type PackageInfo

type PackageInfo struct {
	Name    string
	Path    string
	Version struct {
		Code int
		Name string
	}
}

func StatPackage

func StatPackage(packageName string) (pi PackageInfo, err error)

StatPackage returns PackageInfo If package not found, err will be ErrPackageNotExist

type Processor

type Processor struct {
	Index    int
	BogoMIPS string
	Features []string
}

func ProcessorInfo

func ProcessorInfo() (hardware string, processors []Processor, err error)

ProcessorInfo read from /proc/cpuinfo

Jump to

Keyboard shortcuts

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