AndroidBridge
| Kind | class |
| Package | android.platform |
| Full name | android.platform.AndroidBridge |
| Source | source/android/platform/AndroidBridge.hx |
Central JNI bridge between the Haxe engine and the Phoenix Android native
layer (source/android/src/quack/fnf/phoenix/android/*.java).
Java pushes events through onAndroidEvent(event, arg) and storage
results through handleStorageResult(...); this class demultiplexes them
into the typed signals exposed by the android.platform.* modules.
Everything here is safe to reference on every platform: outside of Android the signals simply never fire and the bound helpers no-op.
Public fields
| Name | Type | Static | Default | Notes |
|---|---|---|---|---|
available | Bool | yes | — | property (get, never) · True when running on a real Android build with the native layer available. |
onLifecycleEvent | FlxTypedSignal<String->Void> = new FlxTypedSignal<String->Void>() | yes | — | Lifecycle event names: onCreate/onStart/onResume/onPause/onStop/onRestart/onDestroy. |
onLowMemory | FlxSignal | yes | new FlxSignal() | Fired on Activity#onLowMemory. |
onTrimMemory | FlxTypedSignal<Int->Void> = new FlxTypedSignal<Int->Void>() | yes | — | Fired on Activity#onTrimMemory with the trim level. |
onMediaPlay | FlxSignal | yes | new FlxSignal() | — |
onMediaPause | FlxSignal | yes | new FlxSignal() | — |
onMediaStop | FlxSignal | yes | new FlxSignal() | — |
onMediaNext | FlxSignal | yes | new FlxSignal() | — |
onMediaPrevious | FlxSignal | yes | new FlxSignal() | — |
onMediaSeek | FlxTypedSignal<Float->Void> = new FlxTypedSignal<Float->Void>() | yes | — | Seek request from the system media UI, position in milliseconds. |
onFocusChanged | FlxTypedSignal<String->Void> = new FlxTypedSignal<String->Void>() | yes | — | Audio focus changes: "gain", "loss", "lossTransient", "duck". |
onGamepadConnected | FlxTypedSignal<Int->Void> = new FlxTypedSignal<Int->Void>() | yes | — | Gamepad device id connected. |
onGamepadDisconnected | FlxTypedSignal<Int->Void> = new FlxTypedSignal<Int->Void>() | yes | — | Gamepad device id disconnected. |
onGamepadChanged | FlxTypedSignal<Int->Void> = new FlxTypedSignal<Int->Void>() | yes | — | Gamepad device id changed (configuration update). |
onHardwareKey | FlxTypedSignal<Int->Bool->Void> = new FlxTypedSignal<Int->Bool->Void>() | yes | — | Hardware key events (volume keys as input): keyCode, isDown. |
onDisplayChanged | FlxSignal | yes | new FlxSignal() | Display configuration changed (rotation/refresh/mode). |
onDeepLink | FlxTypedSignal<String->Void> = new FlxTypedSignal<String->Void>() | yes | — | Incoming phoenix:// deep link (or any VIEW data URI). |
onIntentAction | FlxTypedSignal<String->Void> = new FlxTypedSignal<String->Void>() | yes | — | Non-launch intents that carried no data (informational). |
onPermissionsResult | FlxTypedSignal<String->Void> = new FlxTypedSignal<String->Void>() | yes | — | Results of runtime permission requests (CSV of granted permissions). |
onRecoveryState | FlxTypedSignal<String->Void> = new FlxTypedSignal<String->Void>() | yes | — | Recovery state blob restored after a warm restart. |
onStorageResult | FlxTypedSignal<AndroidStorageResult->Void> = new FlxTypedSignal<AndroidStorageResult->Void>() | yes | — | SAF picker results. |
Public methods
new (constructor)
function new()
Explicit constructor: classes built by lime's JNISafety autoBuild macro
don't get the compiler-generated default one, so new AndroidBridge()
would fail to type without this.
ensureRegistered
static function ensureRegistered():Void
Registers this dispatcher with the Java side. Called automatically by
AndroidPlatform.init(); safe to call multiple times.
onAndroidEvent
function onAndroidEvent(event:String, arg:String):Void
Only compiled when #if android.
| Parameter | Type | Default |
|---|---|---|
event | String | — |
arg | String | — |
handleStorageResult
function handleStorageResult(requestCode:Int, resultCode:Int, uri:String, name:String, size:Float, bytes:Dynamic):Void
Only compiled when #if android.
| Parameter | Type | Default |
|---|---|---|
requestCode | Int | — |
resultCode | Int | — |
uri | String | — |
name | String | — |
size | Float | — |
bytes | Dynamic | — |
watchDeepLink
static function watchDeepLink(listener:String->Void):Void
Only compiled when #if android.
Subscribes to onDeepLink and registers the subscription with the
delivery tracker. Use this instead of onDeepLink.add(...) so a
buffered cold-start deep link can be confirmed delivered to you; the
bridge immediately tries to drain any pending link.
| Parameter | Type | Default |
|---|---|---|
listener | String->Void | — |
drainPendingDeepLink
static function drainPendingDeepLink():Bool
Only compiled when #if android.
Pulls the buffered cold-start deep link from the native layer and
delivers it to onDeepLink subscribers. The native buffer is only
cleared after confirmed delivery, so the link keeps retrying until
something subscribes via watchDeepLink. Returns true when there is
nothing (left) to deliver, false while a link is still waiting for a
subscriber.
Internals
Private / internal members
| Field | Type | Static |
|---|---|---|
registered | Bool | yes |
instance | AndroidBridge | yes |
deepLinkListeners | Int | yes |
_getPendingDeepLink | Dynamic | yes |
_clearPendingDeepLink | Dynamic | yes |
RESULT_OK | Int | yes |
| Method |
|---|
static inline function get_available():Bool |
static function getPendingDeepLink_jni():String |
static function clearPendingDeepLink_jni():Void |