Android
Android support targets API 23 and later. Generated Gradle projects use a HuxerUI library module for the Java host and statically link the framework into the application shared library by default. The generated application shell loads the actual CMake artifact name. Third-party shared libraries can still be packaged as separate APK dependencies.
huxerui setup androidhuxerui run androidThe application Runtime owns shared services; each host view attaches a UiWindow for composition and input. Java/Kotlin lifecycle, input method, accessibility node provider, file picker, HTTP transport, and system bars cross the JNI boundary into shared C++ behavior. Keep app UI code platform-neutral and add Android-specific factories through typed ApplicationContext registration.
Android defaults to safe-area content. Choose WindowContentMode::EdgeToEdge to draw behind system bars, then use SafeAreaPadding and SystemBarsAppearance. Software-keyboard viewport adjustment is distinct from physical safe-area insets.
PlatformView factories are declared by <huxerui/android/platform_registry.h>. External texture sources use <huxerui/android/external_texture.h>. JNI work must run on the UI thread and respect Java reference lifetime.
Android behavior must still be validated on devices or emulators for API level, density, system-bar mode, IME resize policy, accessibility service, document provider, and network security configuration.
System capability boundaries
Section titled “System capability boundaries”Local notifications require application channel/icon metadata, a channel on API 26+, and notification permission for API 33+. Durable scheduling needs the explicit non-exported receiver; custom RemoteViews templates need an application layout provider on API 24+. Permissions and channel policy can suppress accepted delivery.
See Local notifications for shared usage and platform configuration, and System API for exact contracts.
Permission requests require the matching manifest declarations and a live platform launcher. Use the application settings target for an app grant and the system target for a disabled global capability when supported. Approximate location and selected-media access can yield Limited for permissions requiring broader scope.
Window modules and Activity results
Section titled “Window modules and Activity results”Use JavaPlatformModuleFactory for application Context-only capabilities and JavaWindowPlatformModuleFactory for a module that needs its original HuxerUIView. Register either factory through ApplicationContext; open it after installation.
A window factory can retain the launch capability instead of retaining an Activity:
public HuxerUIPlatformModule create( HuxerUIView window, PlatformPayload options, HuxerUIPlatformChannel.Events events) { return new DocumentModule(window.getActivityResultLauncher(), events);}The application supplies DocumentModule and implements invoke/dispose. The retained HuxerUIActivityResultLauncher can launch a configured result-producing Intent:
return launcher.launch(intent, new HuxerUIActivityResultLauncher.Callback() { @Override public void onResult(int resultCode, Intent data) { handleDocumentResult(resultCode, data); }
@Override public void onFailure(RuntimeException error) { failRequest(error); }});These are integration fragments inside the library’s window factory/module. Native RESULT_CANCELED is an ordinary result, while host/launch failures enter onFailure. Both callbacks run asynchronously on the main thread, at most once. Cancel suppresses delivery and requests dismissal; the active presentation slot remains occupied until a result or host closure.
The host Activity connects ActivityResultHost, forwards results through dispatchActivityResult, and updates setActivityResultResumed. Generated shells own this wiring; an embedding host must supply it. Capture the launcher once at factory creation: a retired launcher must never target a replacement attachment.
Import an externally supplied URI
Section titled “Import an externally supplied URI”HuxerUIFileReference.fromUri(context, uri) creates a retained read capability from a content/file URI while access is valid. Call it on a worker while the provider/grant remains readable; it may copy into SDK-owned temporary storage and throws IOException for unsupported/unreadable input. It returns a file reference, not an editable path or persistent grant.
Pass that reference through PlatformPayload rather than extracting a path. Keep it, its opened stream or pending operation alive until consumption completes, then close owned Java wrappers. A display name/MIME type is metadata, not a content validation result.
Open a seekable document descriptor
Section titled “Open a seekable document descriptor”Use FileReference::OpenRandomAccess() for portable offset-based I/O. To pass a descriptor to an Android library, include <huxerui/android/jni.h> and call android::OpenSeekableFileDescriptor(reference, access, mode) on a worker. It supports existing whole-file content URIs that can supply a compatible descriptor. Read-write or truncating access requires the original grant to authorize it.
The returned FileDescriptor owns the fd and retains the provider grant. Borrow its Get() value for a consumer that leaves ownership with the caller. Keep the owner alive throughout the consumer’s work and close it afterward. Serialize descriptor use, close, and moves. If the provider cannot supply seekable access or requires reliable Java close signaling, use the reference’s sequential I/O instead.
Current host boundaries
Section titled “Current host boundaries”SoftwareKeyboardPolicy and ShowKeyboard/HideKeyboard request IME visibility without ending editor focus. System appearance and font scaling follow the window host. Programmatic OpenWindow is unavailable; platform-managed activity attachments still share the application’s services and State.
The website checks shared C++ contracts and Web rendering. Android URI providers, Activity results, permissions, keyboard and module teardown still require device/emulator validation.

