public interface SurfaceBridge
The platform seam of the external surfaces framework, implemented by ports and returned from
CodenameOneImplementation.getSurfaceBridge() (null on unsupported ports, making 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 as live model objects, because surfaces render while the app process may be dead. Implementations MUST persist published payloads (shared container, files dir, preferences) so the platform renderer can re-render them without the app running.
Action events travel in the opposite direction: the port decodes its platform payload (deep
link, intent extras, window click) and calls com.codename1.surfaces.Surfaces.dispatchAction,
which handles EDT marshaling and cold-start queuing.
Methods
Method details
areWidgetsSupported
public abstract boolean areWidgetsSupported()isLiveActivitySupported
public abstract boolean isLiveActivitySupported()registerWidgetKind
public abstract void registerWidgetKind(String kindJson)Parameters
kindJsonString- the serialized kind declaration
publishWidgetTimeline
public abstract void publishWidgetTimeline(String kindId, String timelineJson, Map<String, byte[]> images)Parameters
kindIdString- the widget kind id
timelineJsonString- the serialized timeline (layouts, entries, image names)
imagesMap<String, byte[]>- PNG blobs keyed by registered name; may be empty, never null
reloadWidgets
public abstract void reloadWidgets(String kindId)Parameters
kindIdString- the widget kind to reload, or null for all kinds
getInstalledWidgetCount
public abstract int getInstalledWidgetCount(String kindId)Parameters
kindIdString- the widget kind id
startLiveActivity
public abstract String startLiveActivity(String descriptorJson, Map<String, byte[]> images)Parameters
descriptorJsonString- the serialized descriptor including the initial state
imagesMap<String, byte[]>- PNG blobs keyed by registered name; may be empty, never null
Returns
updateLiveActivity
public abstract void updateLiveActivity(String activityId, String stateJson)Parameters
activityIdString- the id returned from
startLiveActivity stateJsonString- the serialized state map
endLiveActivity
public abstract void endLiveActivity(String activityId, String finalStateJson, boolean dismissImmediately)Parameters
activityIdString- the id returned from
startLiveActivity finalStateJsonString- an optional final state shown before dismissal, or null
dismissImmediatelyboolean- true to remove the surface right away instead of letting the platform linger on the final state