T

NativeJavaBridge

The Android bridge to Java through reflection. Sync calls run on the JavaScript thread, so touch views only asynchronously.

type NativeJavaBridge = { … }

Members

Runs independent operations in one call on the JavaScript thread and returns every result in order.

Runs the operations like batch, on the main thread, so views can be read safely.

Reads an object's class name, as a string value.

construct(name: string, args?: NativeJavaArgument[]): NativeHandle

Calls the constructor matching args and returns a handle the scope holds until released.

Creates a key for attaching a value to objects with setAssociatedObject.

Lists a class's constructors, methods and fields.

Frees a call plan; using it afterwards throws.

Finds the views of a class under or above a view, on the main thread, like objc.findViews.

Reads the value attached to an object under a key.

getClass(name: string): NativeHandle

Looks up a class by fully qualified name and returns a handle the scope holds until released.

Reads a field by name.

Calls a method on the JavaScript thread.

Calls a method on the main thread and resolves with its result. Needs native.java.invokeAsync.

Calls a prepared method on the JavaScript thread, like invoke.

Calls a prepared method on the main thread and resolves with its result, like invokeAsync.

prepare(target: NativeJavaReference, name: string, parameterTypes: readonly string[]): NativeJavaCallPlan

Resolves a method by name and parameter types once, for repeated calls through invokePrepared.

Drops the plugin's hold on a handle so the loader can free the object.

Checks whether the object has a method name callable with args, as a boolean value.

Attaches a value to an object under a key.

setField(handle: NativeJavaReference, name: string, value: NativeJavaArgument): void

Writes a field by name.