public interface IntentBridge

The platform seam of the app intents framework, implemented by ports and returned from CodenameOneImplementation.getIntentBridge() – null on unsupported ports, which makes the whole public API an inert no-op.

Everything crosses this boundary as data: JSON strings produced by the core serializer plus named PNG blobs, never live model objects. The reason is the same one the surfaces framework gives: the peer on the other side is Swift or Kotlin, and an invocation can arrive while the app process has no UI and was started only to answer it. Keeping the wire format to strings is also what leaves the door open to hosting intents in a separate process later without changing a line of Java.

Invocations travel the other way: the port decodes its platform payload and calls com.codename1.intents.Intents.dispatchInvocation, which owns thread marshalling, the cold-start queue and the deadline.

Methods

public abstract boolean areIntentsSupported()True when this port can expose intents to the platform at all.
public abstract boolean isHeadlessExecutionSupported()True when this port can run an intent without bringing the app to the foreground.
public abstract boolean isVoiceInvocationSupported()True when a voice assistant can invoke intents on this port.
public abstract boolean isIndexingSupported()True when this port can publish app content to a system-wide search index.
public abstract void registerIntents(String declarationsJson)Hands the port the application’s full intent catalogue during startup, so it can validate against what was compiled into the native app and prepare whatever the platform needs.
public abstract void donate(String intentId, String paramsJson)Tells the platform the user just ran this intent, so it can suggest it later.
public abstract void index(String entitiesJson, Map<String, byte[]> images)Publishes app content to the system search index, replacing any entry with the same id.
public abstract void removeFromIndex(String idsJson)Removes specific entries from the system search index.
public abstract void clearIndex(String entityType)Removes every entry of one type, or the whole index.
public abstract void completeInvocation(String token, String resultJson, Map<String, byte[]> images)Hands the platform the outcome of an invocation it started.
public abstract boolean requestForeground()Asks the platform to bring the application to the foreground, and reports whether it could.

Method details

areIntentsSupported

public abstract boolean areIntentsSupported()
True when this port can expose intents to the platform at all.

isHeadlessExecutionSupported

public abstract boolean isHeadlessExecutionSupported()
True when this port can run an intent without bringing the app to the foreground.

isVoiceInvocationSupported

public abstract boolean isVoiceInvocationSupported()
True when a voice assistant can invoke intents on this port. False on Android, where no assistant contract of that shape exists.

isIndexingSupported

public abstract boolean isIndexingSupported()
True when this port can publish app content to a system-wide search index.

registerIntents

public abstract void registerIntents(String declarationsJson)
Hands the port the application’s full intent catalogue during startup, so it can validate against what was compiled into the native app and prepare whatever the platform needs.

Parameters

declarationsJson String
the serialized declarations

donate

public abstract void donate(String intentId, String paramsJson)
Tells the platform the user just ran this intent, so it can suggest it later.

Parameters

intentId String
the intent that ran
paramsJson String
the parameter values it ran with

index

public abstract void index(String entitiesJson, Map<String, byte[]> images)
Publishes app content to the system search index, replacing any entry with the same id.

Parameters

entitiesJson String
the serialized entities
images Map<String, byte[]>
PNG blobs keyed by the name used in the JSON; may be empty, never null

removeFromIndex

public abstract void removeFromIndex(String idsJson)
Removes specific entries from the system search index.

Parameters

idsJson String
the serialized {type, id} pairs to remove

clearIndex

public abstract void clearIndex(String entityType)
Removes every entry of one type, or the whole index.

Parameters

entityType String
the type to clear, or null for everything this app indexed

completeInvocation

public abstract void completeInvocation(String token, String resultJson, Map<String, byte[]> images)

Hands the platform the outcome of an invocation it started.

Called at most once per token; the framework enforces that, because the iOS side of this boundary crashes when a continuation is resumed twice.

Parameters

token String
the invocation token the port supplied
resultJson String
the serialized result
images Map<String, byte[]>
PNG blobs referenced by a snippet; may be empty, never null

requestForeground

public abstract boolean requestForeground()

Asks the platform to bring the application to the foreground, and reports whether it could.

Called when a handler that ran without a window returns a route. The route is navigated either way – the Form is built in whatever runtime is up – but on a headless invocation that runtime has nothing on screen, so without this the destination is created and never seen.

True means the application is forward, not that a launch was requested. The framework navigates as soon as this returns, so a port that posts an asynchronous launch and answers true immediately has the route built against a runtime that is about to be torn down – on Android, by the stopContext that follows a headless handler. A port whose launch is asynchronous must wait, and must bound that wait so a launch that never completes degrades rather than hangs.

False is a legitimate answer, not a failure. iOS does not let an application bring itself forward; there, foregrounding is decided before the handler runs, by the openAppWhenRun the build derives from opensRoute. A port that answers false is telling the framework to say so rather than leaving the developer to discover it on a device.

Never called on the event dispatch thread by a platform-dispatched invocation. An in-process Intents#invoke may reach it from any thread, including the EDT, which is why a port must answer immediately when the application is already forward.