mirror of https://github.com/jetkvm/kvm.git
24 lines
432 B
Go
24 lines
432 B
Go
//go:build android && cgo
|
|
|
|
package anet
|
|
|
|
// #include <android/api-level.h>
|
|
import "C"
|
|
|
|
import "sync"
|
|
|
|
var (
|
|
apiLevel int
|
|
once sync.Once
|
|
)
|
|
|
|
// Returns the API level of the device we're actually running on, or -1 on failure.
|
|
// The returned value is equivalent to the Java Build.VERSION.SDK_INT API.
|
|
func androidDeviceApiLevel() int {
|
|
once.Do(func() {
|
|
apiLevel = int(C.android_get_device_api_level())
|
|
})
|
|
|
|
return apiLevel
|
|
}
|