Skip to main content

AndroidSystem

Kindclass
Packageandroid.platform
Full nameandroid.platform.AndroidSystem
Sourcesource/android/platform/AndroidSystem.hx

Device-state information: memory pressure, battery state, screen wake locking and process-death recovery state.

Public fields​

NameTypeStaticDefaultNotes
onLowMemoryFlxSignalyes—property (get, never) · Fired when the system reports low memory.
onTrimMemoryFlxTypedSignal<Int->Void>yes—property (get, never) · Fired on trim-memory requests with the trim level.

Public methods​

getBatteryInfo​

static function getBatteryInfo():Null<BatteryInfo>

Battery information, or null when unavailable/non-Android.

View source

acquireWakeLock​

static function acquireWakeLock():Void

Keeps the screen on (e.g. during gameplay).

View source

releaseWakeLock​

static function releaseWakeLock():Void

Allows the screen to turn off again.

View source

setRecoveryState​

static function setRecoveryState(state:String):Void

Persists an opaque state blob (JSON) that survives Android killing the process while backgrounded. Store whatever is needed to restore the user's context (e.g. current song + difficulty) and read it back with consumeRecoveryState() on the next startup.

ParameterTypeDefault
stateString—

View source

consumeRecoveryState​

static function consumeRecoveryState():String

Returns the persisted recovery blob and clears it. Returns "" when nothing was stored (or on non-Android targets).

View source

getSDKInt​

static function getSDKInt():Int

Android SDK version (0 on other platforms).

View source

getDeviceInfo​

static function getDeviceInfo():String

"manufacturer|model|device|arch" (empty on other platforms).

View source

Internals​

Private / internal members
FieldTypeStatic
_getBatteryInfoDynamicyes
_acquireWakeLockDynamicyes
_releaseWakeLockDynamicyes
_setRecoveryStateDynamicyes
_getRecoveryStateDynamicyes
_getSDKIntDynamicyes
_getDeviceInfoDynamicyes
Method
static inline function get_onLowMemory():FlxSignal
static inline function get_onTrimMemory():FlxTypedSignal<Int->Void>
static function getBatteryInfo_jni():String
static function acquireWakeLock_jni():Void
static function releaseWakeLock_jni():Void
static function setRecoveryState_jni(state:String):Void
static function getRecoveryState_jni():String
static function getSDKInt_jni():Int
static function getDeviceInfo_jni():String