Android native script host
The Android Java/JNI host uses QuickJS embedded in sqs_map and retainsimport {map} from 'sqsmap'. Map,script,input,resource results and destruction execute on the creating owner thread. Frames,events,script state and errors are callbacks. The application builds its own layer panels,navigation and UI.
NativeMapHost.open(widthPixels,heightPixels,new NativeMapHost.Listener(){
public void onFrame(int width,int height,byte[] rgba){
// Owner-thread callback:convert RGBA and post work to your UI.
}
public void onEvents(String json){ /* update your tools */ }
public void onScriptState(String json){ /* initialization and callbacks */ }
public void onError(Throwable error){ /* present or record errors */ }
},null).thenAccept(host -> host.runScript(
"import {map} from 'sqsmap';map.jumpTo({center:[105,25],zoom:4});export default {};"));
Retained listeners explicitly exportsessionMode='persistent'. The runScript future means session start;onScriptState reports initialization. Re-running releases the previous session. stopScript keeps map data;closeAsync cancels transport,executes bounded remove callbacks,destroys the map and releases the session. Keep callbacks short and never block on owner-thread futures inside them.
JNI carries UTF-8 JSON and independent RGBA copies;C output allocations are freed immediately. Default HTTP follows native deadline/retry/fallback/byte plans and honors no-store. It uses at most4 transport workers,32 owned jobs and64MiB encoded-response reservations;working copies,native decoding and GPU storage have additional costs. Transport is replaceable. Cancelled generations/duplicate responses cannot mutate a new map. Default WS/WSS is connected; custom protocols still require application Transport.
Legacy open/resize calls retain DPR1. New pixelRatio overloads separate logical input from dense physical output; onFrame supplies actual dimensions. Map touches through the drawn View rectangle to framebuffer pixels, then divide by density; seedisplay density. POINTER forwards shared touch snapshots;optional AndroidTouchInput supplies recognized pan/zoom/rotate/pitch and tap events on the application View;seetouch navigation. getStyle exposes layers/sources,getAttributions exposes credits that the application must present. This standalone map host does not include the desktop GIS application's full API;select scripts using actual capabilities.
Java requires Android API24+. Match the JNI bridge,native-library ABI and public header;build the library with the script feature. Seeintegration,Java host,JNI,CMakeandversion/SHA. Retain QuickJS,font and other dependency notices.
Local evidence covers11 JNI and18 full host checks (including density/legacy resize),the same12-check script and actual glyph pixels,including touch,HTTP/UTF-8,resize,idle,stop/destroy. Minimum API24 Java,ARM64 JNI and the script-enabled native library cross-compile/link successfully;records are separate. Linux JVM/software-GPU checks do not count as phone acceptance. Android devices/drivers,mobile GIS application integration,iOS and formal release remain pending.
Build the native library with the core release-capi profile (panic unwind). The Android helper selects it and writes target/aarch64-linux-android/release-capi/libsqs_map.so. A normal release/abort binary can link but cannot create high-level maps. The owner validates ABI/session versions and all three unwind/script/session flags before creation; linking alone does not establish runtime support.
Custom streaming responses support same-generation frames and backpressure; default WS/WSS is available through the default receiver.
Default WS/WSS live sources are connected in04.8c6; devices and system network security require separate acceptance.
For layout embedding, frame display, and lifecycle wiring, see Android map view.
New frame listeners may implement onFrame(width,height,rgba,FrameFormat). The current high-level native host uses offscreen readback with SRGB_PREMULTIPLIED_RGBA, including flat views; existing three-argument listeners still receive frames. Android Bitmap conversion decodes sRGB, undoes premultiplication in linear space, and re-encodes; swapping channels or dividing encoded bytes by alpha is insufficient. SqsMapView handles the conversion centrally. Public operations admit at most32 pending entries and reject excess with RESOURCE_LIMIT; closing bypasses this budget.