Widgets, Live Activities, and Dynamic Island From One Java API
Widget support was one of the earliest Codename One requests. We dismissed it for years because a widget must render while the application UI is not running. A normal Codename One Component needs the application renderer, event dispatch thread, and live object graph. A home-screen widget gets none of those. What is Codename One? Codename One is an open-source framework for building native iOS, Android, desktop, and web apps from a single Java or Kotlin codebase. Learn more at codenameone.com . The missing piece had been under our nose for a decade. Steve added background processes so an app could refresh data without showing its UI. That solves the update side. The rendering side becomes possible once the widget is data rather than a live component. PR #5365 turns that observation into com.codename1.surfaces , one API for home-screen widgets, Live Activities, Dynamic Island, Android ongoing notifications, and desktop floating widgets. The dead-process rule An external surface is a piece of application state that the operating system can render outside the app. The app publishes a serializable layout and a timeline of state maps. The platform persists that data, then renders it with its own surface technology. You cannot attach a Java listener to a widget. There may be no Java process to invoke. You assign a string action ID instead. A tap launches the app and delivers that action after startup. The simulator implements the same model. Open Widgets > Widgets Preview to inspect every registered kind, move through its timeline, change size and appearance, and click actions without creating a device build. Widget kinds exist at build time iOS and Android compile widget galleries into the native application. The kinds must therefore be known during the build. Add a surfaces.json resource: { "liveActivities" : true , "kinds" : [ { "id" : "delivery_status" , "name" : "Delivery" , "description" : "Track your order" , "iosFamilies" : [ "systemSmall" , "systemMedium" ] } ] }