AndroidPlatform
| Kind | class |
| Package | android.platform |
| Full name | android.platform.AndroidPlatform |
| Source | source/android/platform/AndroidPlatform.hx |
Facade for the Phoenix Android platform layer.
Call AndroidPlatform.init() once at startup (Main.hx does this) and the
whole native layer becomes available through the dedicated modules:
- AndroidMedia Media3 session/service, MediaStyle notification, audio focus
- AndroidDisplay resolution/DPI/orientation/refresh rate/cutouts, immersive fullscreen
- AndroidSystem memory pressure, battery, wake lock, process-death recovery
- AndroidGamepad controller info + connection events
- AndroidHardwareInput volume keys as bindable game input
- AndroidHaptics vibration
- AndroidStorage SAF document picker + content:// URIs
- AndroidIntents URLs, settings, file sharing
- AndroidNotification simple notifications
- AndroidLifecycle Activity lifecycle signals
- AndroidDiscord presence through the media session
On non-Android targets every module compiles to safe no-ops, so none of the desktop/web/Flash/HashLink/iOS builds depend on Android code.
Public fields
| Name | Type | Static | Default | Notes |
|---|---|---|---|---|
active | Bool | yes | false | property (default, null) · True once init() completed on Android; always false elsewhere. |
Public methods
init
static function init(autoPauseAudio:Bool = true, watchDisplay:Bool = true):Void
Boots the platform layer: registers the JNI bridge, starts lifecycle handling, controller watching and memory-pressure responses.
@param autoPauseAudio pause/resume music when the Activity backgrounds @param watchDisplay start receiving display change events
| Parameter | Type | Default |
|---|---|---|
autoPauseAudio (optional) | Bool | true |
watchDisplay (optional) | Bool | true |
Internals
Private / internal members
| Field | Type | Static |
|---|---|---|
initialized | Bool | yes |
deepLinkDrainTimer | FlxTimer | yes |
| Method |
|---|
static function releaseCaches():Void |
static function flushSave():Void |