Package com.codename1.intents.spi


package com.codename1.intents.spi

The platform seam of the app intents framework. Ports implement IntentBridge; applications use com.codename1.intents and never touch this package.

Everything crosses as data

The bridge trades JSON strings and named PNG blobs, never live objects. Three forces push it that way and they all point the same direction: the peer is Swift or Kotlin rather than Java; an invocation can arrive in a process that was started only to answer it, with no UI and no application state warmed up; and keeping the wire format to strings is what would let intents be hosted in a separate process later without changing a line of Java. It is the same rule the com.codename1.surfaces package states, for the same reasons.

The two directions

Outward, the core calls the bridge: publishing the intent catalogue at startup, donating a completed action, writing entities into the device search index, and handing back the result of an invocation.

Inward, the port calls com.codename1.intents.Intents.dispatchInvocation after decoding its own platform payload. The port does not marshal threads, enforce the deadline, or handle a cold start; the core owns all three so every platform behaves identically. In particular the core guarantees completeInvocation fires exactly once per token -- a handler that finishes after the deadline has already been reported as failed and its late answer is dropped, because the iOS side of this boundary crashes when a continuation is resumed twice.

Returning null is a complete implementation

CodenameOneImplementation.getIntentBridge() returns null by default and a port that cannot support intents leaves it that way. The public API then degrades to inert no-ops -- except Intents.invoke, which keeps working, because in-process dispatch runs through build-time generated code rather than through this bridge.

  • Interfaces
    Class
    Description
    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.