AndroidSystem
| Kind | class |
| Package | android.platform |
| Full name | android.platform.AndroidSystem |
| Source | source/android/platform/AndroidSystem.hx |
Device-state information: memory pressure, battery state, screen wake locking and process-death recovery state.
Public fields
| Name | Type | Static | Default | Notes |
|---|---|---|---|---|
onLowMemory | FlxSignal | yes | — | property (get, never) · Fired when the system reports low memory. |
onTrimMemory | FlxTypedSignal<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.
acquireWakeLock
static function acquireWakeLock():Void
Keeps the screen on (e.g. during gameplay).
releaseWakeLock
static function releaseWakeLock():Void
Allows the screen to turn off again.
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.
| Parameter | Type | Default |
|---|---|---|
state | String | — |
consumeRecoveryState
static function consumeRecoveryState():String
Returns the persisted recovery blob and clears it. Returns "" when nothing was stored (or on non-Android targets).
getSDKInt
static function getSDKInt():Int
Android SDK version (0 on other platforms).
getDeviceInfo
static function getDeviceInfo():String
"manufacturer|model|device|arch" (empty on other platforms).
Internals
Private / internal members
| Field | Type | Static |
|---|---|---|
_getBatteryInfo | Dynamic | yes |
_acquireWakeLock | Dynamic | yes |
_releaseWakeLock | Dynamic | yes |
_setRecoveryState | Dynamic | yes |
_getRecoveryState | Dynamic | yes |
_getSDKInt | Dynamic | yes |
_getDeviceInfo | Dynamic | yes |
| 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 |