<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[DebugAgent]]></title><description><![CDATA[Author, Open Source Hacker, Entrepreneur, Blogger, DevRel, Java Rockstar, Conference Speaker and Instructor.]]></description><link>https://debugagent.com</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1667657766117/5UtfvXIdI.png</url><title>DebugAgent</title><link>https://debugagent.com</link></image><generator>RSS for Node</generator><lastBuildDate>Tue, 24 Nov 2026 07:06:51 GMT</lastBuildDate><atom:link href="https://debugagent.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Ship Your Game on Steam, and Why the Art Matters More Than the Engine]]></title><description><![CDATA[Splat is a full-stack, first-person team paintball shooter template in Java, refereed by its own server, with a mission builder, replays and party voice…]]></description><link>https://debugagent.com/ship-your-game-on-steam-and-why-the-art-matters-more-than-the-engine</link><guid isPermaLink="true">https://debugagent.com/ship-your-game-on-steam-and-why-the-art-matters-more-than-the-engine</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Tue, 24 Nov 2026 01:01:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/392c417f-77b9-4b80-9172-3020ab94b08e.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The engine is the least important decision in a small game. Art decides whether people play it, the server decides whether it's fair, and the store decides whether anyone finds it. Splat, our third game template after Skirmish and <a href="https://www.codenameone.com/blog/build-an-endless-runner-in-java/">Dash</a>, is a first person team paintball shooter, four against four, in 3D, online, written in Java with Codename One. It's the kind of game people assume needs a commercial engine. Watch it first and judge for yourself.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p><a href="https://www.codenameone.com/blog/release-2026-11-13/splat-desktop-demo.mp4">Download the desktop video</a>.</p>
<img src="https://www.codenameone.com/developer-guide/img/splat-home.png" alt="The Splat home screen on a phone" style="display:block;margin:0 auto" />

<p>Home on a phone.</p>
<img src="https://www.codenameone.com/developer-guide/img/splat-match-overhead.png" alt="A Splat match seen from above" style="display:block;margin:0 auto" />

<p>A match from above.</p>
<img src="https://www.codenameone.com/developer-guide/img/splat-mission-editor.png" alt="The Splat mission editor" style="display:block;margin:0 auto" />

<p>The mission editor.</p>
<img src="https://www.codenameone.com/developer-guide/img/splat-mission-playtest.png" alt="Play testing a custom Splat field" style="display:block;margin:0 auto" />

<p>Play testing a field.</p>
<img src="https://www.codenameone.com/developer-guide/img/splat-party-chat.png" alt="A Splat party lobby with voice chat" style="display:block;margin:0 auto" />

<p>Party lobby and voice.</p>
<img src="https://www.codenameone.com/developer-guide/img/splat-instant-replay.png" alt="A Splat instant replay" style="display:block;margin:0 auto" />

<p>Instant replay.</p>
<p>It's paintball, and it never stops making fun of itself. Every match opens with a mission briefing read in the gravest voice available, and every hit stamps a big red <strong>PAINTED</strong> across your goggles.</p>
<h2>The lesson: the engine isn't the star</h2>
<p>I'll start with what surprised me, because it's the most useful thing in this post.</p>
<p>The first playable Splat drew its fields and players from shapes generated in code. The networking worked, the shots were lag compensated, the referee caught cheaters. It looked like a tech demo, and nobody wanted to play it for more than a minute.</p>
<p>Then we replaced the shapes with real art: CC0 models from <a href="https://quaternius.com">Quaternius</a> and <a href="https://kenney.nl">Kenney</a>, photo scanned props and ground textures from <a href="https://polyhaven.com">Poly Haven</a>, players built with MakeHuman and type set in Rajdhani. Nothing else changed, and it was suddenly a game.</p>
<p>Only after that did we add the engine features. Fog with height falloff, PBR materials, directional shadows and post processing all went into the framework because the art deserved them, not the other way around. If you're building a game, budget for the artist first. A better renderer makes good art look great. It does nothing for boxes.</p>
<p>CC0 means none of those artists asked for credit. We credit them anyway, in <code>scripts/splat/ART.md</code>, along with the steps to re-skin every model.</p>
<h2>What the framework gained</h2>
<p>Building Splat added these to <code>com.codename1.gpu</code>, on every GPU backend: OpenGL in the simulator and on Linux, Android, WebGL in the browser, Metal on iOS and Direct3D 11 on Windows.</p>
<ul>
<li><code>Environment</code>: exponential fog with height falloff, hemisphere ambient light, exposure and tone mapping, and a procedural sky through <code>Environment.setSky</code>.</li>
<li><code>Material.Type.PBR</code>: metallic and roughness, emissive and vertex color, filled from glTF.</li>
<li><strong>Shadows</strong>: directional shadow maps through <code>Light.setShadows</code>, softened with percentage closer filtering.</li>
<li><code>PostProcess</code> on a <code>GameView</code>: bloom, color grading, vignette and grain.</li>
<li><code>GpuCapabilities</code>: on a device without shadow or offscreen support the scene draws directly instead of failing.</li>
</ul>
<img src="https://www.codenameone.com/developer-guide/img/splat-desktop-match.png" alt="A Splat match on the desktop with fog and shadows" width="1600" height="940" />

<p>A match on the desktop.</p>
<img src="https://www.codenameone.com/developer-guide/img/splat-briefing.png" alt="A Splat mission briefing" style="display:block;margin:0 auto" />

<p>The briefing.</p>
<img src="https://www.codenameone.com/developer-guide/img/splat-scoreboard.png" alt="The Splat scoreboard" style="display:block;margin:0 auto" />

<p>The scoreboard.</p>
<h2>The server is the referee</h2>
<p>In a shooter, whoever decides a hit decides the game. If the phone decides, a modified client wins every fight. Splat's backend runs the match and the phone predicts:</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBQW1Bob25lPGJyLz5wcmVkaWN0cyBtb3ZlbWVudCBhbmQgc2hvdHNdIC0tPnxpbnB1dHMgb3ZlciBXZWJTb2NrZXR8IFNbQmFja2VuZCByZWZlcmVlPGJyLz4zMCBIeiBmaXhlZC1wb2ludCBydWxlc10KICAgIFMgLS0-fGF1dGhvcml0YXRpdmUgc3RhdGV8IFAKICAgIFMgLS0-IFJbUmV3aW5kcyB0byB0aGUgc2hvb3RlcidzIHZpZXc8YnIvPnRvIGNoZWNrIHRoZSBoaXRdCiAgICBTIC0tPiBBW0FudGktY2hlYXQgZmxhZ3MsIFhQLCByYXRpbmddCiAgICBTIC0tPiBSUFtSZXBsYXlzIGFuZCBsZWFkZXJib2FyZHNd?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>The shared simulation code is fixed point and deterministic, and the same code runs on the phone and on the server. A golden corpus of recorded matches replays in CI, so a change that alters the outcome of a past match fails the build. Shots are lag compensated: the server rewinds to what the shooter saw, within a cap, so a hit that looked right on a slow connection counts.</p>
<p>Around the match there's matchmaking by skill, parties with lobby codes and WebRTC voice chat, instant replays, a shop with store receipts checked against Apple and Google, and an admin console with moderation. The sound effects, music and ambience are all synthesized in code, so no audio files ship at all.</p>
<h2>Build your own field</h2>
<p>The mission builder lets players design a field on the phone or the desktop, play test it against bots and publish it to friends. You build one half and the other half mirrors it, so every field is fair.</p>
<p><a href="https://www.codenameone.com/blog/release-2026-11-13/splat-mobile-mission-builder.mp4">Download the phone video</a>. <a href="https://www.codenameone.com/blog/release-2026-11-13/splat-mobile-demo.mp4">Download the phone gameplay video</a>.</p>
<p><a href="https://www.codenameone.com/blog/release-2026-11-13/splat-desktop-mission-builder.mp4">Download the desktop mission builder video</a>.</p>
<h2>Steam: the console you're allowed to ship on</h2>
<p>Last week I wrote that <a href="https://www.codenameone.com/blog/codename-one-on-xbox/">shipping on consoles needs SDKs behind NDAs</a>. Steam is the exception. Valve's Steam Machine and the Steam Deck run Linux, Steamworks is open to any developer who pays the app fee, and the same binary runs on Linux desktops. It's the one major open console.</p>
<p>Codename One publishes to Steam with the native Linux port: one native executable, no JVM, packaged as a Steam depot and uploaded with SteamPipe. Set the app id:</p>
<pre><code class="language-properties">codename1.arg.steam.appId=480
codename1.arg.steam.branch=beta
</code></pre>
<p>Then build locally, or let the cloud do it:</p>
<pre><code class="language-bash">mvn cn1:buildSteamLocal                   # depot in linux/target/steam
mvn cn1:steamUpload -Dsteam.user=builder  # upload with SteamCMD
mvn cn1:buildSteam                        # or build in the cloud
</code></pre>
<p>In the build cloud console you save your Steam builder account once, then press "Submit to Steam" or turn on submitting every build. Valve only lets an upload go live on a beta branch, so promotion to the default branch and Valve's review happen on the Steamworks site, as they do for everyone.</p>
<h3>Controllers and Steam features from portable code</h3>
<p>Games on Steam are expected to work with a controller, and players on the Deck and in Big Picture mode often have nothing else. Every gamepad Steam knows about arrives through <code>Gamepads</code>, and forms can be navigated with the D-pad with no code at all:</p>
<pre><code class="language-java">Gamepad pad = Gamepads.getGamepad(0);
if (pad != null &amp;&amp; pad.isConnected()) {
    float x = pad.getAxis(Gamepad.AXIS_LEFT_X);   // -1..1, dead zone applied
    boolean jump = pad.isButtonDown(Gamepad.BUTTON_A);
}
</code></pre>
<p>Achievements, stats, cloud saves, rich presence, DLC ownership and the overlay go through <code>GameServices</code>. Off Steam the calls do nothing, so the same game builds for iOS and Android unchanged:</p>
<pre><code class="language-java">if (GameServices.isAvailable()) {             // true on Steam
    GameServices.unlockAchievement("FIRST_WIN");
    GameServices.setStat("wins", GameServices.getStatInt("wins", 0) + 1);
    GameServices.commit();
    GameServices.writeSave("slot1", saveBytes);
}
</code></pre>
<p>The app starts full screen, text fields open Steam's on-screen keyboard in Gaming Mode, and <code>isControllerFirst()</code> tells you when to show controller prompts instead of mouse hints.</p>
<p>A few things the Steam runtime doesn't provide: there's no embedded browser, no GStreamer media playback and no secure storage. Games rarely need them, but check the <a href="https://www.codenameone.com/developer-guide/#steam">Steam chapter</a> before you plan around one.</p>
<h2>Learn more</h2>
<p>Generate Splat from the Initializr, read the implementor's guide in the developer guide, and swap the art for your own. Then point it at Steam. If you ship a game this way, send it to me. I'd love to play it.</p>
]]></content:encoded></item><item><title><![CDATA[Kafka Listeners, Mail and Live Streams in Your Backend, With Records as Entities]]></title><description><![CDATA[The Codename One backend now sends and receives messages over Kafka, RabbitMQ, Redis Streams, SQS and Pub/Sub, accepting Spring's listener annotations as…]]></description><link>https://debugagent.com/kafka-listeners-mail-and-live-streams-in-your-backend-with-records-as-entities</link><guid isPermaLink="true">https://debugagent.com/kafka-listeners-mail-and-live-streams-in-your-backend-with-records-as-entities</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Mon, 23 Nov 2026 01:01:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/e88276a6-0c19-435a-9eac-b4cadcb86c7c.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>On Friday I said that <a href="https://www.codenameone.com/blog/shopify-was-wrong-and-right-to-dump-react-native/">one codebase pays twice</a> when it includes the server. That claim is worthless if the server can't do what a real service does: consume a queue, send a receipt email, push live updates and store data in the shape the language prefers. This week the Codename One backend does all four, and on the last one it does something JPA still forbids.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>The backend compiles Java to C and then to a native executable. Listener wiring, repositories and builders are generated at build time, with no proxies and no reflection at run time. The annotations follow Spring's, because a controller that moves over with no edits is worth more than a clever new API.</p>
<img src="https://www.codenameone.com/developer-guide/img/backend-architecture.png" alt="Java compiled to C to a native binary, and a request travelling through a host thread and a virtual thread to the handler" style="display:block;margin:0 auto" />

<h2>Records as entities: ahead of JPA</h2>
<p>Records have been in Java since 16. They're the obvious shape for data: immutable, with <code>equals</code>, <code>hashCode</code> and <code>toString</code> for free. Yet the Jakarta Persistence spec still requires an entity to be a non-final class with a no-argument constructor that the provider can mutate. A record is none of those, so you can't make one a JPA entity. Hibernate accepts records as embeddables and stops there.</p>
<p>Codename One's ORM maps them, on the device and on the server:</p>
<pre><code class="language-java">@Entity
public record Note(@Id long id, String title, int score,
        @Version long version, @DbTransient String scratch) {}
</code></pre>
<p>The build generates a builder for each record, including a copy builder for changes:</p>
<pre><code class="language-java">Notes notes = Repositories.create(Notes.class, session);
session.beginTransaction();
Note saved = notes.save(NoteBuilder.create().title("Groceries").score(3).build());
// saved.id() is the generated key
Note changed = notes.save(NoteBuilder.of(saved).score(5).build());
session.commitTransaction();
</code></pre>
<p><code>save</code> returns a managed copy that carries the generated key and the new version. The record you passed in is never changed, which is what immutability is supposed to mean. Records are read through their accessors and built through the canonical constructor, and nothing is woven into the class.</p>
<p>Relationships use <code>Ref&lt;T&gt;</code>, because a record can't have a field set after it's built:</p>
<pre><code class="language-java">@Entity
public record Purchase(@Id long id, @ManyToOne Ref&lt;Customer&gt; customer,
        long amountCents) {}

Purchase p = session.find(Purchase.class, id);
long customerId = p.customer().id();          // no query
String name = p.customer().get().name();      // loads the customer
</code></pre>
<p>There are limits, and the build tells you when you hit one. Records need sources compiled at Java 17. A record that holds its own entity type, a <code>Map</code> relationship or a lazy <code>Optional</code> fails the build with an explanation, and relationships inside an embedded record aren't supported. Records run on iOS and every other target ParparVM translates.</p>
<p>I like this one because it's a case of us leading instead of following. JPA users have asked for record entities since records shipped.</p>
<h2>Kafka, RabbitMQ and Redis with the annotations you know</h2>
<p>Messaging is one API over seven transports, selected by a URL:</p>
<pre><code class="language-properties">cn1.messaging.url=kafka://kafka-1:9092,kafka-2:9092
</code></pre>
<p><code>memory:</code>, <code>db:</code>, <code>redis://</code> (Streams), <code>amqp://</code> (RabbitMQ), <code>kafka://</code>, <code>sqs://</code> and <code>pubsub://</code> are supported, with TLS forms for each. Spring Boot's own properties, such as <code>spring.kafka.bootstrap-servers</code>, are read too. With a database and no URL, messages go through a table, which is often all a small service needs.</p>
<p>Sending a message inside a transaction writes it to an outbox, and it goes out after the commit. A rolled back order never announces itself:</p>
<pre><code class="language-java">@Component
public class Checkout {
    private final DataSource db;
    private final MessageTemplate messages;

    public Checkout(DataSource db, MessageTemplate messages) {
        this.db = db;
        this.messages = messages;
    }

    @Transactional
    public void place(Order order) throws IOException {
        db.execute("INSERT INTO orders (id, customer) VALUES (?, ?)",
                new Object[]{Long.valueOf(order.id), order.customer});
        messages.send("orders.placed", order.customer, order);
    }
}

@Component
public class Shipping {
    @MessageListener(value = "orders.placed", group = "shipping", concurrency = 4)
    public void placed(Order order) {
        // ship it
    }
}
</code></pre>
<p>Code ported from Spring can keep <code>@KafkaListener(topics = ..., groupId = ...)</code>, <code>@RabbitListener(queues = ...)</code> and <code>@JmsListener</code> as written. Delivery is at least once, with consumer groups, retries and a dead letter destination per topic.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBUWyJAVHJhbnNhY3Rpb25hbCBwbGFjZSgpIl0gLS0-IERCWyhvcmRlcnMpXQogICAgVCAtLT4gT0JbKG91dGJveCldCiAgICBPQiAtLT58YWZ0ZXIgY29tbWl0fCBCUltLYWZrYSAvIFJhYmJpdE1RIC8gUmVkaXMgLyBTUVNdCiAgICBCUiAtLT4gTFsiQE1lc3NhZ2VMaXN0ZW5lcjxici8-Z3JvdXAgc2hpcHBpbmciXQogICAgTCAtLT58ZmFpbHMgcmVwZWF0ZWRseXwgRExRW29yZGVycy5wbGFjZWQuZGxxXQ==?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>Each broker protocol is written on the backend's own network layer, with no client library, and a protocol your configuration doesn't name isn't compiled into the executable. That has a cost: Kafka reads gzip but not snappy, lz4 or zstd yet, and doesn't do transactions or SASL. The <a href="https://www.codenameone.com/developer-guide/#backend-messaging">messaging chapter</a> lists every limit.</p>
<p>The same release adds a shared key value store, <code>cn1.kv.url=redis://...</code>, which works with Redis, Valkey, and KeyDB. It backs the cache, sessions, rate limiting and the locks that keep a <code>@Scheduled</code> job from running on two servers at once.</p>
<h2>Email from the backend</h2>
<p>Signup confirmations, receipts, password resets. Every service sends mail, and every service eventually sends a welcome email for an account whose transaction rolled back. Codename One stages mail sent inside a transaction and sends it on commit:</p>
<pre><code class="language-java">@Transactional
public void register(String name, String email) throws IOException {
    db.execute("INSERT INTO accounts (name, email) VALUES (?, ?)",
            new Object[]{name, email});
    mail.send(Mail.to(email).subject("Welcome, " + name)
            .text("Your account is ready.").build());
}
</code></pre>
<pre><code class="language-properties">cn1.mail.url=smtp://${SMTP_USER}:${SMTP_PASSWORD}@smtp.example.com:587
cn1.mail.from=Acme &lt;no-reply@example.com&gt;
</code></pre>
<p>SMTP with STARTTLS, SMTPS and Amazon SES are supported, plus <code>log:</code> and <code>memory:</code> for development and tests. Templates, attachments and inline images work. Failed sends retry with backoff for up to six attempts, permanent failures aren't retried, and mail that gives up lands in a table you can inspect. The built-in security module now uses it for email verification, password reset and mailed sign-in codes. Receiving mail and DKIM signing aren't supported; use your provider for those.</p>
<h2>Server-sent events</h2>
<p>Prices, progress bars and LLM tokens all need a server that pushes. WebSockets are the heavy answer. Server-sent events are plain HTTP, pass through proxies, and reconnect by themselves:</p>
<pre><code class="language-java">@GetMapping("/prices")
public HttpServer.Response prices(HttpServer.Request request) {
    return Sse.stream(request, events -&gt; {
        long last = parse(events.lastEventId());
        for (int idle = 0; idle &lt; 600; idle++) {
            long newest = PriceBoard.newest();
            if (newest &gt; last) {
                events.event("price").id(Long.toString(newest))
                        .json(PriceBoard.since(last));
                last = newest;
            } else if (idle % 15 == 0) {
                events.ping();
            }
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                return;
            }
        }
    });
}
</code></pre>
<p><code>lastEventId()</code> lets a reconnecting client resume where it stopped, and <code>HttpProxy</code> relays event streams unchanged, so a backend can forward an LLM provider's token stream to the app without buffering it.</p>
<h2>More of Spring, fewer workarounds</h2>
<p>We keep porting real services to the backend, starting with our own build cloud, and every port finds small gaps. This round closed a long list: per call repository transactions, <code>@Lock</code> on derived finds and queries, the <code>Before</code>, <code>After</code>, <code>Between</code> and <code>IgnoreCase</code> query keywords, repeated <code>@RequestParam</code>, catch-all route variables like <code>{*path}</code>, inherited controller mappings, <code>CommandLineRunner</code> and <code>ApplicationRunner</code>, ready events, executor queue limits with a <code>TaskDecorator</code>, tagged gauges and histograms, and header rewriting in <code>HttpProxy</code>.</p>
<p>None of these is a headline. Together they decide whether a Spring controller moves over with no edits or with twenty.</p>
<h2>Learn more</h2>
<p>The <a href="https://www.codenameone.com/developer-guide/#backend-messaging">messaging</a> and <a href="https://www.codenameone.com/developer-guide/#backend-mail">mail</a> chapters have the full configuration, server-sent events are in the web chapter, and record entities are in the ORM chapter under "Record entities." If you have a Spring service you'd like to move and something's missing, tell me which annotation.</p>
]]></content:encoded></item><item><title><![CDATA[Subscriptions, Paywalls and a Customer Center, and We Don't Take a Cut]]></title><description><![CDATA[Codename One Commerce now covers offerings, remotely configured paywalls, targeting and experiments, a customer center with refunds and retention offers…]]></description><link>https://debugagent.com/subscriptions-paywalls-and-a-customer-center-and-we-don-t-take-a-cut</link><guid isPermaLink="true">https://debugagent.com/subscriptions-paywalls-and-a-customer-center-and-we-don-t-take-a-cut</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Sun, 22 Nov 2026 01:01:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/e6ef8939-d6fe-4950-b62e-15f3ee0514aa.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you sell subscriptions in an app, you already give Apple or Google up to 30%. The usual next step is a subscription platform, because store receipts are miserable to validate and a paywall you can't change without an app update is a paywall you'll never test. The best known of those platforms charge a percentage of your revenue on top of the store's. The more you earn, the more you pay them, for the same API calls.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>A percentage is the wrong price for this. Validating a receipt costs the same whether it's for a $2 app or a $200 plan, so a fee that grows with your revenue is a tax on success. In July we shipped <a href="https://www.codenameone.com/blog/commerce-secrets-without-iap-tax/">Commerce</a> as receipt validation and entitlements. This release adds offerings, remote paywalls, experiments, a customer center and invites, and keeps the rule that matters: the money goes from the store, or your own Stripe or Paddle account, straight to you. Codename One never touches the money, so there's no commission to take.</p>
<img src="https://www.codenameone.com/blog/commerce-secrets-without-iap-tax/commerce.png" alt="The Commerce overview in the console" style="display:block;margin:0 auto" />

<h2>One question: does this user have access?</h2>
<p>Commerce is built around entitlements. An entitlement is an access right like <code>pro</code> or <code>remove_ads</code>, and you map store products to it in the console. Your code never asks about products:</p>
<pre><code class="language-java">CommerceManager cm = CommerceManager.getInstance();
if (cm.isEntitled("pro")) {
    // unlock
} else {
    new Thread(() -&gt; {
        Offering current = cm.getOfferings().getCurrent();   // network call
        if (current != null) {
            CN.callSerially(() -&gt; Paywall.show(current, null));
        }
    }).start();
}
</code></pre>
<p>A subscription bought on an iPhone unlocks the same account on Android, on the desktop and on the web. Access is decided by one rule, the latest expiry over the active grants measured against the service's clock, so a user who sets the phone's clock back doesn't get a free month.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBJW0FwcCBTdG9yZV0gLS0-IFZbQ29tbWVyY2Ugc2VydmljZTxici8-dmFsaWRhdGVzIHJlY2VpcHRzXQogICAgR1tHb29nbGUgUGxheV0gLS0-IFYKICAgIEFbQW1hem9uIEFwcHN0b3JlXSAtLT4gVgogICAgU1tZb3VyIFN0cmlwZSBvciBQYWRkbGVdIC0tPiBWCiAgICBWIC0tPiBFW0VudGl0bGVtZW50OiBwcm9dCiAgICBFIC0tPiBQW2lQaG9uZV0KICAgIEUgLS0-IERbQW5kcm9pZF0KICAgIEUgLS0-IFdbV2ViIGFuZCBkZXNrdG9wXQogICAgSSAtLiBtb25leSAuLT4gWVtZb3VdCiAgICBHIC0uIG1vbmV5IC4tPiBZCiAgICBBIC0uIG1vbmV5IC4tPiBZCiAgICBTIC0uIG1vbmV5IC4tPiBZ?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>The dotted lines are the point. The service sees receipts. It never sees a card number and nothing flows through us.</p>
<h2>Five stores, one purchase call</h2>
<ul>
<li><strong>Apple App Store</strong>, on iOS and on the Mac App Store for native Mac builds.</li>
<li><strong>Google Play</strong>, validated through Google's own server API.</li>
<li><strong>Amazon Appstore</strong>, with one build hint. The build swaps the Play Billing Library for Amazon's SDK and drops the billing permission Amazon rejects. Your code doesn't change.</li>
<li><strong>Stripe and Paddle</strong> for the web and the desktop, where there's no store. A hosted checkout in your own account sells the same package.</li>
</ul>
<p><code>purchase(CommercePackage)</code> does the right thing on each platform. Where there's a store it sells the store product. Where there isn't, and the package has a web price, it opens the checkout:</p>
<pre><code class="language-java">new Thread(() -&gt; {
    Offering current = cm.getOfferings().getCurrent();
    if (current != null &amp;&amp; current.getAnnual() != null) {
        CN.callSerially(() -&gt; cm.purchase(current.getAnnual()));
    }
}).start();
</code></pre>
<h2>Paywalls you change without a release</h2>
<p>Offerings are configured in the console: which packages you sell, which one is current, and placements for different screens. Targeting rules and experiments decide which offering a given customer gets, and they're evaluated on every <code>getOfferings</code> call, so a change takes effect without an app update.</p>
<p>Experiments assign variants by hashing the experiment id with the user id. The same customer sees the same variant on every device and after every restart, and nothing about the assignment is stored. The console reports impressions, purchases and the conversion rate for each variant.</p>
<p>The built-in paywall is themed with UIIDs, like any other Codename One component. For more control there's a paywall document, a JSON description with strings per locale, colors and <code>{{price}}</code> style templates, edited in the console with a live preview that uses the same <code>PaywallView</code> class as the device.</p>
<h2>A customer center, so users don't email you to cancel</h2>
<p>One call shows a form where the customer sees their subscriptions and acts on them:</p>
<pre><code class="language-java">CustomerCenter.show();
</code></pre>
<p>You choose which paths it offers and in what order:</p>
<table>
<thead>
<tr>
<th>Path</th>
<th>What it does</th>
</tr>
</thead>
<tbody><tr>
<td><code>MANAGE</code></td>
<td>The store's subscription management, or the billing portal for a web subscription</td>
</tr>
<tr>
<td><code>RESTORE</code></td>
<td>Restores the store account's purchases</td>
</tr>
<tr>
<td><code>REFUND</code></td>
<td>Asks the store for a refund</td>
</tr>
<tr>
<td><code>CANCEL</code></td>
<td>Asks why, shows a retention offer for that reason if you have one, then continues to the store</td>
</tr>
<tr>
<td><code>SUPPORT</code></td>
<td>Your support page or email</td>
</tr>
</tbody></table>
<p>The cancel path is where the money is. A customer who's leaving because it's too expensive can be offered a discount right there, and the reason is reported either way, so you learn why people leave instead of guessing.</p>
<h2>Invites, referral rewards and virtual currency</h2>
<p>Users can invite friends, and purchases by invited users are tracked back to the person who invited them. A referral can grant an entitlement or currency, and by the time your code sees it the reward is already in effect:</p>
<pre><code class="language-java">CustomerInfo info = CommerceManager.getInstance().getCustomerInfo();
for (ReferralReward reward : info.getReferralRewards()) {
    String earned = reward.isCurrency()
            ? reward.getAmount() + " " + reward.getCurrencyCode()
            : reward.getEntitlementId();
    Dialog.show("Thank you", "Your invite earned you " + earned, "OK", null);
}
long coins = info.getCurrencyBalance("coins");
</code></pre>
<p>Subscriber attributes, lifecycle webhooks, a REST API, revenue reports and export and import round out the list. Export matters: if you ever want to leave, your customer data leaves with you.</p>
<h2>When the service is down, users keep access</h2>
<p>Commerce is optional and fails soft. If commerce is off in the build, the device is offline or the service can't answer, the app falls back to the stored answer and the store's own receipts, so a paying user keeps what they paid for. Code that talks to the older <code>Purchase</code> API directly keeps working unchanged.</p>
<p>For server-authoritative validation you enter your own store credentials in the console: the App Store key, a Google service account, the Amazon shared secret and your Stripe or Paddle keys. They're your accounts. We validate against them, and the payouts never pass through anything we run.</p>
<h2>Learn more</h2>
<p>The <a href="https://www.codenameone.com/developer-guide/#_commerce">Commerce chapter</a> covers setup for each store, identity and account transfer, the paywall document format, experiments and the analytics events. If you're paying a percentage of your revenue for this today, run the numbers and tell me what you find.</p>
]]></content:encoded></item><item><title><![CDATA[Calendars, Gantt Charts and Booking Apps Without Writing a Calendar]]></title><description><![CDATA[Codename One now ships a scheduler with day, week, month, agenda and resource views, a Gantt chart with dependencies, baselines, the critical path and…]]></description><link>https://debugagent.com/calendars-gantt-charts-and-booking-apps-without-writing-a-calendar</link><guid isPermaLink="true">https://debugagent.com/calendars-gantt-charts-and-booking-apps-without-writing-a-calendar</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Sat, 21 Nov 2026 01:01:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/193e032b-00d9-4e5f-8ab3-c1efb3083ff6.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Yesterday I argued that <a href="https://www.codenameone.com/blog/shopify-was-wrong-and-right-to-dump-react-native/">a framework should give you more than the OS does</a>. Here's the test case. Nobody ships a calendar view you can fill with your own appointments, or a Gantt chart. Not iOS, not Android, not Flutter, not React Native, not Kotlin Multiplatform, not .NET MAUI. Every one of them leaves you with a date picker and a blank screen. If your app books haircuts, plans shifts or tracks a project, you write that screen yourself, once per platform if you went native, or you license a commercial component and pay for it every year. Codename One ships both, in the box, free.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>Codename One now ships a scheduler, a Gantt chart with resource leveling, and Material 3 date and time pickers. Codename One draws its own UI, so these are the same component, pixel for pixel, on iOS, Android, the desktop and the web, and they take their look from your CSS.</p>
<img src="https://www.codenameone.com/developer-guide/img/generated/gantt-critical-path.png" alt="A Gantt chart with the critical path highlighted" style="display:block;margin:0 auto" />

<h2>A scheduler in ten lines</h2>
<p>The model and the UI are separate. <code>com.codename1.scheduling</code> holds the data with no UI, so the same classes work in your server code. <code>com.codename1.ui.scheduler</code> draws it.</p>
<pre><code class="language-java">ZoneId zone = ZoneId.systemDefault();
long today = TimeMath.epochDay(System.currentTimeMillis(), zone);

DefaultScheduleModel model = new DefaultScheduleModel();
model.addItem(new ScheduleItem("review", "Design review",
        TimeMath.at(today, 13 * 60, zone), TimeMath.at(today, 14 * 60 + 30, zone))
        .setDetail("Room 2"));

Scheduler scheduler = new Scheduler(model);
scheduler.setView(Scheduler.View.WEEK);

Form form = new Form("Schedule", new BorderLayout());
form.add(BorderLayout.CENTER, scheduler);
form.show();
</code></pre>
<img src="https://www.codenameone.com/developer-guide/img/generated/scheduler-week.png" alt="The scheduler in week view" style="display:block;margin:0 auto" />

<p><code>Scheduler.View</code> gives you <code>DAY</code>, <code>WORK_WEEK</code>, <code>WEEK</code>, <code>MONTH</code>, <code>AGENDA</code> and <code>RESOURCE_DAY</code>, and there's a resource timeline for "who's busy when" screens. Items can be dragged and resized with snapping (<code>setSnapMinutes</code>), the working hours come from a <code>WorkCalendar</code>, and <code>setZone</code> lets a clinic in Berlin see the schedule in Berlin time while the phone is in Lisbon.</p>
<img src="https://www.codenameone.com/developer-guide/img/generated/scheduler-month.png" alt="The scheduler month view" style="display:block;margin:0 auto" />

<p>Month.</p>
<img src="https://www.codenameone.com/developer-guide/img/generated/scheduler-resource-day.png" alt="The scheduler showing a day per resource" style="display:block;margin:0 auto" />

<p>A day per resource.</p>
<img src="https://www.codenameone.com/developer-guide/img/generated/scheduler-day-dark.png" alt="The scheduler day view in dark mode" style="display:block;margin:0 auto" />

<p>Dark mode.</p>
<h2>A Gantt chart that knows who's doing the work</h2>
<p>The <code>Gantt</code> component reads a <code>ProjectModel</code>: tasks with durations, dependencies between them and the people assigned to them. It draws bars you can drag, dependencies you can link by dragging from one bar to another, a baseline to compare against, collapsible groups and the critical path, which is the chain of tasks where any delay moves the end date.</p>
<img src="https://www.codenameone.com/developer-guide/img/generated/gantt-leveled.png" alt="A leveled plan with the load per person" style="display:block;margin:0 auto" />

<p>The part I'm proudest of is resource leveling. A plan that looks fine on paper often has the same developer on two tasks in the same week. <code>ResourceLeveler</code> finds those overallocations and proposes a fix, and you decide whether to apply it:</p>
<pre><code class="language-java">WorkCalendar calendar = new WorkCalendar();
ProjectModel project = new ProjectModel(calendar, System.currentTimeMillis());
project.addResource(new ScheduleResource("dev", "Developer"));
project.addTask(new GanttTask("api", "API", 3 * calendar.getMillisPerDay()).assign("dev"));
project.addTask(new GanttTask("screens", "Screens", 2 * calendar.getMillisPerDay()).assign("dev"));
project.update();

if (!ResourceLeveler.findOverallocations(project).isEmpty()) {
    LevelingResult proposal = ResourceLeveler.level(project);
    long slip = proposal.getFinishAfter() - proposal.getFinishBefore();
    if (proposal.isChanged() &amp;&amp; Dialog.show("Level resources",
            proposal.getChangedTasks().size() + " tasks move; the project ends "
                    + slip / TimeMath.DAY + " days later.", "Apply", "Cancel")) {
        proposal.apply();
    }
}
</code></pre>
<p>The proposal tells you which tasks move and how much later the project ends, before anything changes. The load histogram under the chart shows the result: no more stacked bars for one person.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBQW1Byb2plY3RNb2RlbDxici8-dGFza3MsIGxpbmtzLCBwZW9wbGVdIC0tPiBTW1Byb2plY3RTY2hlZHVsZXI8YnIvPmRhdGVzIGZyb20gd29yayBjYWxlbmRhcl0KICAgIFMgLS0-IE97UmVzb3VyY2VMZXZlbGVyPGJyLz5vdmVyYWxsb2NhdGVkP30KICAgIE8gLS0-fG5vfCBHW0dhbnR0IGRyYXdzIGl0XQogICAgTyAtLT58eWVzfCBMW0xldmVsaW5nUmVzdWx0PGJyLz53aGF0IG1vdmVzLCBuZXcgZW5kIGRhdGVdCiAgICBMIC0tPnx1c2VyIGFwcGxpZXN8IEc=?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<img src="https://www.codenameone.com/developer-guide/img/generated/gantt-baseline.png" alt="A Gantt chart with baseline bars" style="display:block;margin:0 auto" />

<p>Against the baseline.</p>
<h2>Material 3 pickers, styled your way</h2>
<p>The date, time and date and time pickers now come as Material 3 dialogs: a month grid with a year list and a field to type the date, and a clock dial with a keyboard mode. Apps on the Android Material native theme get them with no code. Any other theme asks for them with one constant:</p>
<pre><code class="language-css">#Constants {
    pickerStyle: "material";
}
</code></pre>
<p>Existing <code>Picker</code> code doesn't change. Branding them is a few rules on the <code>PickerMaterial</code> UIIDs:</p>
<pre><code class="language-css">PickerMaterialDay.selected {
    background-color: #0f766e;
    color: #ffffff;
}

PickerMaterialDial.selected {
    background-color: #0f766e;
    color: #ffffff;
}
</code></pre>
<img src="https://www.codenameone.com/developer-guide/img/generated/picker-material-date.png" alt="The Material 3 date picker" style="display:block;margin:0 auto" />

<p>The date picker.</p>
<img src="https://www.codenameone.com/developer-guide/img/generated/picker-material-time.png" alt="The Material 3 time picker clock dial" style="display:block;margin:0 auto" />

<p>The clock dial.</p>
<img src="https://www.codenameone.com/developer-guide/img/generated/picker-material-date-css.png" alt="The date picker restyled with teal CSS rules" style="display:block;margin:0 auto" />

<p>Restyled in CSS.</p>
<img src="https://www.codenameone.com/developer-guide/img/generated/picker-material-time-dark.png" alt="The time picker in dark mode" style="display:block;margin:0 auto" />

<p>Dark mode.</p>
<p>This is the lightweight argument in one picture. A native date picker looks the way Apple or Google decided it looks this year. These look the way you decide, on every device, and a field that needs the platform's own dialog can still ask for it with <code>setUseLightweightPopup(false)</code>.</p>
<h2>Slate: a booking app you can ship</h2>
<p><a href="https://www.codenameone.com/blog/release-2026-11-13/slate-desktop-demo.mp4">Download the desktop video</a>.</p>
<p><a href="https://www.codenameone.com/blog/release-2026-11-13/slate-owner-demo.mp4">Download the owner video</a>.</p>
<p>Slate is our new full-stack template: an appointment booking app and its server, in one Maven project. Salons, clinics, tutors, personal trainers: anyone who sells time. Generate it from the <a href="https://www.codenameone.com/initializr/">Initializr</a> under your own name and package. The source is MIT-0, so you owe nothing and credit nobody.</p>
<img src="https://www.codenameone.com/developer-guide/img/slate-book-slots.png" alt="Slate showing free times for a service" width="1080" height="1920" />

<p>Free times.</p>
<img src="https://www.codenameone.com/developer-guide/img/slate-book-confirm.png" alt="Slate confirming a booking with a deposit" width="1080" height="1920" />

<p>Confirm, with a deposit.</p>
<img src="https://www.codenameone.com/developer-guide/img/slate-provider-week.png" alt="A provider's week in Slate" width="1080" height="1920" />

<p>The provider's week.</p>
<img src="https://www.codenameone.com/developer-guide/img/slate-owner-staffing.png" alt="The owner's staffing plan as a Gantt chart, with each provider's load under it" width="1080" height="1920" />

<p>The week's staffing, as a Gantt chart.</p>
<img src="https://www.codenameone.com/developer-guide/img/slate-owner-preview.png" alt="The owner previewing booking rules on a real day" width="1080" height="1920" />

<p>Rules, previewed on a real day.</p>
<p>It has three roles, and the server decides which screens an account sees:</p>
<ul>
<li><strong>Clients</strong> see free times by day or week, with times that clash with their own phone calendar marked. A hold keeps the slot while they book, they can pay a deposit, and the booking lands in their calendar with a reminder that moves if they reschedule. There's a waitlist for full days.</li>
<li><strong>Providers</strong> manage hours and time off, mark appointments complete or no-show, and sync their calendars from the phone, Google, Microsoft or an ICS address. Event titles never leave the device; Slate only needs to know when they're busy.</li>
<li><strong>Owners</strong> get a dashboard, a board for the day, a staffing plan for the week, the service catalog and booking rules they can preview on a real day before saving them.</li>
</ul>
<p>The hard part of a booking product is the slot engine, and that's where most of Slate's server lives. It weighs providers, rooms, buffers between appointments, travel time, gap rules and the client's own calendar together, and the hold prevents two clients from getting the same slot.</p>
<img src="https://www.codenameone.com/developer-guide/img/slate-desktop-owner-dashboard.png" alt="Slate's owner dashboard on the desktop" style="display:block;margin:0 auto" />

<p>It runs on iOS, Android, the desktop and the web, and the backend runs on SQLite, PostgreSQL, MySQL, or MariaDB.</p>
<h3>Slate runs on the scheduler and the Gantt chart</h3>
<p>Slate's calendar screens are the components in this post. The provider's day and week are <code>Scheduler</code> views, and the owner's day board is the <code>RESOURCE_DAY</code> view with a column per provider. The owner's staffing plan is a <code>Gantt</code> chart: a row per provider, a bar per shift filled as far as it's booked, and the resource load under it showing who has room this week. The <a href="https://www.codenameone.com/slate/">implementor's guide</a> walks through how a week of schedules becomes a project model.</p>
<h2>Learn more</h2>
<p>The <a href="https://www.codenameone.com/developer-guide/#scheduling-and-gantt">Scheduling and Gantt charts chapter</a> covers every view, renderer, listener and CSS hook, including printing with <code>SchedulePrinter</code>. The pickers are under "Material date and time pickers" in the components chapter, and Slate has a <a href="https://www.codenameone.com/slate/">user's guide and an implementor's guide</a>.</p>
<p>If you build planning or booking software, I'd like to know which view you need that isn't there yet.</p>
]]></content:encoded></item><item><title><![CDATA[Shopify Was Wrong and Right to Dump React Native]]></title><description><![CDATA[Shopify dumped React Native for two native codebases because agents write the second copy for free. React Native deserved it: it's a heavyweight toolkit…]]></description><link>https://debugagent.com/shopify-was-wrong-and-right-to-dump-react-native</link><guid isPermaLink="true">https://debugagent.com/shopify-was-wrong-and-right-to-dump-react-native</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Fri, 20 Nov 2026 01:01:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/c5ca6d1f-f0ef-4133-980d-aa2164904deb.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In September Shopify announced it's <a href="https://shopify.engineering/back-to-native">moving every mobile app off React Native</a> and rewriting them in Swift and Kotlin. Their reasoning fits in one sentence from the post: "building the same feature in Swift and Kotlin no longer carries the cost it used to." Agents write the second copy, so why share code at all?</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>React Native deserved to die. It's a heavyweight toolkit, and every heavyweight toolkit, from AWT to Xamarin.Forms, was eventually replaced by a lightweight one or by native code. Replacing it with two native codebases is wrong, because it takes the most expensive part of React Native, a separate platform per target, and doubles it. Code was never the cost. Platforms, testing and store churn are, and AI makes every one of them worse.</p>
<p>This isn't a post against AI. I use LLMs every day, and in the right setting they're superb. But they can't hold a Samsung phone, they don't know what Apple will announce next June, and they can't sign off on a release. Shopify's plan needs them to do all three.</p>
<h2>TL;DR</h2>
<ul>
<li><a href="#react-native-was-built-to-fail-at-write-once-run-anywhere"><strong>React Native was designed to fail at the one thing you adopted it for.</strong></a> Its creators rejected write once, run anywhere in the launch announcement. In writing.</li>
<li><a href="#heavyweight-and-lightweight"><strong>Your buttons belong to Samsung.</strong></a> Heavyweight toolkits hand your UI to the OS and the vendor skin, which is why Samsung's keyboard can hang your text field.</li>
<li><a href="#lightweight-is-the-architecture-that-works"><strong>Not looking 100% native is a feature, and here's why.</strong></a> Lightweight toolkits ship the pixels you tested, and still embed a native map or web view when you need one.</li>
<li><a href="#two-codebases-is-the-same-mistake-twice"><strong>Shopify's own post explains why its plan fails.</strong></a> Agents write code in seconds and need minutes to test it. Two codebases double the slow part.</li>
<li><a href="#there-are-no-two-platforms"><strong>"iOS and Android" is a lie.</strong></a> The web, the desktop, tablets, foldables, the watch, the car, TVs, consoles and embedded devices are all platforms too, and your developers end up as meat proxies between users and an LLM.</li>
<li><a href="#the-web-and-the-desktop-are-the-product-now"><strong>Meta gave up on a native WhatsApp desktop app. You have fewer engineers than Meta.</strong></a></li>
<li><a href="#testing-is-the-bill"><strong>Testing is the real bill, and AI makes it bigger.</strong></a></li>
<li><a href="#the-stores-change-the-rules-every-year"><strong>Apple broke apps with UIScene. Ours didn't notice.</strong></a></li>
<li><a href="#a-platform-should-give-you-more-than-the-os"><strong>A framework should beat the OS, not wrap it.</strong></a> Gantt charts, commerce with no commission, records as entities, every protection a bank app needs, built once, and a Base64 encoder nearly three times faster than Apple's.</li>
<li><a href="#the-full-stack-is-where-one-codebase-pays-twice"><strong>One codebase pays double when it includes the server.</strong></a> Plus my generous offer of a PHP port.</li>
</ul>
<h2>Coming This Week</h2>
<p>Before we proceed, here's a preview of this week on the blog:</p>
<ul>
<li><strong>Saturday, November 14:</strong> <a href="https://www.codenameone.com/blog/scheduler-gantt-and-material-pickers/">Calendars, Gantt Charts and Booking Apps Without Writing a Calendar</a>. A scheduler, a Gantt chart with critical paths and resource leveling, Material 3 pickers and Slate, our appointment booking template.</li>
<li><strong>Sunday, November 15:</strong> <a href="https://www.codenameone.com/blog/subscriptions-and-paywalls-without-a-revenue-cut/">Subscriptions, Paywalls and a Customer Center, and We Don't Take a Cut</a>. Offerings, experiments, refunds and invites across five stores.</li>
<li><strong>Monday, November 16:</strong> <a href="https://www.codenameone.com/blog/kafka-mail-and-records-in-your-java-backend/">Kafka Listeners, Mail and Live Streams in Your Backend, With Records as Entities</a>. Spring-style messaging, transactional email, server-sent events, and an ORM that's ahead of JPA.</li>
<li><strong>Tuesday, November 17:</strong> <a href="https://www.codenameone.com/blog/ship-your-java-game-on-steam/">Ship Your Game on Steam, and Why the Art Matters More Than the Engine</a>. Splat, a team paintball shooter, and the lesson it taught us.</li>
<li><strong>Wednesday, November 18:</strong> <a href="https://www.codenameone.com/blog/windows-kiosks-and-command-line-apps/">Windows Kiosks and Command Line Tools, Built From Java</a>. Windows IoT Enterprise as a target, and a console API for real terminal tools.</li>
<li><strong>Thursday, November 19:</strong> <a href="https://www.codenameone.com/blog/run-an-llm-on-the-phone/">Run an LLM and Whisper on the Phone, With No Server Bill</a>. Local models through the same API as the cloud ones, so moving a feature onto the phone is a one line change.</li>
</ul>
<p><a href="https://www.codenameone.com/blog/scheduler-gantt-and-material-pickers/"><img src="https://www.codenameone.com/developer-guide/img/generated/gantt-critical-path.png" alt="A Gantt chart with the critical path highlighted" style="display:block;margin:0 auto" /></a></p>
<p>Gantt with the critical path.</p>
<p><a href="https://www.codenameone.com/blog/scheduler-gantt-and-material-pickers/"><img src="https://www.codenameone.com/developer-guide/img/slate-book-slots.png" alt="Slate showing free appointment times" width="1080" height="1920" /></a></p>
<p>Booking in Slate.</p>
<p><a href="https://www.codenameone.com/blog/ship-your-java-game-on-steam/"><img src="https://www.codenameone.com/blog/release-2026-11-13/splat-in-game.jpg" alt="A first-person view of a Splat capture the flag match" style="display:block;margin:0 auto" /></a></p>
<p>Splat, in a match.</p>
<h2>React Native was built to fail at write once, run anywhere</h2>
<p>Nobody should be surprised that React Native didn't deliver one codebase. It never tried. When Facebook <a href="https://legacy.reactjs.org/blog/2015/03/26/introducing-react-native.html">announced it in 2015</a> they wrote: "we're not chasing 'write once, run anywhere.'" They rejected it on purpose, and built a toolkit where platform code is part of the design. Then a decade of teams adopted it believing they'd get one codebase, and spent that decade writing platform code.</p>
<p>The reason is architectural. React Native is a <strong>heavyweight</strong> UI toolkit.</p>
<h3>Heavyweight and lightweight</h3>
<p>UI toolkits come in two families, and the split is older than smartphones.</p>
<p>A <strong>heavyweight</strong> toolkit maps each of your components to a widget the operating system owns. Your button is a <code>UIButton</code> on iOS and an <code>android.widget.Button</code> on Android. Java's AWT worked this way in 1995. So did SWT. Xamarin.Forms, .NET MAUI and React Native repeat it today.</p>
<p>A <strong>lightweight</strong> toolkit asks the OS for a surface and draws every pixel itself. Swing replaced AWT this way. Qt, Flutter and Codename One all draw their own UI.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IFRCCiAgICBzdWJncmFwaCBIW0hlYXZ5d2VpZ2h0OiBSZWFjdCBOYXRpdmUsIE1BVUksIEFXVCwgU1dUXQogICAgICAgIEExW1lvdXIgY29tcG9uZW50XSAtLT58YnJpZGdlIHBlciB3aWRnZXR8IEIxW1VJQnV0dG9uIG9uIGlPU10KICAgICAgICBBMSAtLT58YnJpZGdlIHBlciB3aWRnZXR8IEMxW2FuZHJvaWQud2lkZ2V0LkJ1dHRvbl0KICAgICAgICBCMSAtLT4gRDFbQmVoYXZpb3IgYW5kIGxvb2sgb3duZWQgYnkgQXBwbGVdCiAgICAgICAgQzEgLS0-IEUxW0JlaGF2aW9yIGFuZCBsb29rIG93bmVkIGJ5IEdvb2dsZTxici8-YW5kIFNhbXN1bmcsIFhpYW9taSBhbmQgSHVhd2VpXQogICAgZW5kCiAgICBzdWJncmFwaCBMW0xpZ2h0d2VpZ2h0OiBDb2RlbmFtZSBPbmUsIEZsdXR0ZXIsIFN3aW5nLCBRdF0KICAgICAgICBBMltZb3VyIGNvbXBvbmVudF0gLS0-IFAyW1lvdXIgcmVuZGVyaW5nIGNvZGU8YnIvPmNvbXBpbGVkIGludG8geW91ciBhcHBdCiAgICAgICAgUDIgLS0-IFMyW09uZSBzdXJmYWNlIGZyb20gdGhlIE9TXQogICAgZW5k?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>Heavyweight has exactly one selling point: the widgets are the platform's, so they look the part for free. Everything else is a bill.</p>
<ul>
<li><strong>Many implementations of every widget.</strong> A text field on Android and a text field on iOS are different programs with different bugs, and it doesn't stop at two. Apple alone made everyone move from <code>UIWebView</code> to <code>WKWebView</code>, with different APIs and different behavior, and Android has gone through several generations of its own widgets. Each new target multiplies it again: a TV, a watch or a desktop brings its own set. The abstraction exposes only what all of them agree on, so anything interesting drops to platform code.</li>
<li><strong>A bridge on every interaction.</strong> Layout, events and state cross from your code into the widget and back, on every frame.</li>
<li><strong>Behavior you can't test in one place.</strong> The widget runs inside the OS, so it behaves according to the OS version, the vendor skin and whatever keyboard the user installed. A font that's a pixel taller on one vendor's build clips the bottom of your label. A minor OS update on one device family delivers focus and text events in a slightly different order, and a race that never happened before starts corrupting input on those phones only.</li>
</ul>
<p>That last one is where the money burns. A controlled <code>TextInput</code> <a href="https://github.com/facebook/react-native/issues/35590">hangs on Samsung phones when the Samsung keyboard's Grammarly integration is on</a>. Setting state on a controlled <code>TextInput</code> <a href="https://github.com/facebook/react-native/issues/20361">can duplicate its value</a>. These are races between JavaScript, the bridge and a keyboard Samsung ships. You find them when a user with that phone and that keyboard complains, and you can't reproduce them on anything else.</p>
<p>Then the OS moves under you. When Apple shipped Liquid Glass, every app built with the new SDK got the redesigned system controls whether the team wanted them or not. Apple's escape hatch, the <code>UIDesignRequiresCompatibility</code> key, comes with a promise that it will be removed. And you have to know that key exists. Nobody tells you. With a heavyweight UI you don't just work for your boss. You work for Apple and Google too, reading their release notes and following their instructions every year to keep your own app looking like your own app.</p>
<p>Shopify's own numbers show what that bridge cost them. <a href="https://www.infoq.com/news/2026/09/shopify-drops-react-native/">InfoQ reports</a> cold start dropped 23% on iOS and 50% on Android after the rewrite, and crash-free sessions went from 99.5% to 99.95%. Those numbers are the price of heavyweight, finally itemized.</p>
<h3>Lightweight is the architecture that works</h3>
<p>A lightweight toolkit compiles the UI into your app. The pixels you tested are the pixels that ship, on every phone and every OS version, next year as well as today.</p>
<ul>
<li><strong>One implementation of each component.</strong> A bug fixed once is fixed everywhere.</li>
<li><strong>No bridge.</strong> Drawing your own button needs no round trip into the OS.</li>
<li><strong>Deterministic rendering.</strong> A screenshot test on a CI runner means something. Codename One's CI compares hundreds of screenshots on every commit across iOS, Android, desktop and the web.</li>
<li><strong>Stability.</strong> An OS update can't restyle your app. A buggy vendor skin draws your app the way it draws any other surface.</li>
<li><strong>Native where you want it.</strong> A lightweight UI can still mix in any native component as a peer. Google Maps, a platform web view, a camera preview, a payment sheet or a third party SDK's widget sits inside your layout like any other component. You choose native per component, instead of inheriting it for everything.</li>
</ul>
<p>"It doesn't look 100% native." Correct. That's a feature. It's my app, not Apple's. Our <a href="https://www.codenameone.com/blog/scheduler-gantt-and-material-pickers/">Material 3 date picker</a> is better than most native pickers I've used, and when I want it different I change CSS instead of waiting a year for a vendor to add a parameter.</p>
<p>Accessibility is the real question for any lightweight toolkit, because the OS can't read a button it didn't draw. A lightweight toolkit has to publish its components to VoiceOver and TalkBack itself. Codename One does, and <a href="https://www.codenameone.com/blog/ios-density-scroll-and-accessibility/">keeps improving it</a>. Ask every lightweight framework how it handles this. The answer separates the serious ones from the rest.</p>
<p>That last point deserves emphasis, because it's the answer to every "but I need the real thing" objection. In Codename One a <code>PeerComponent</code> places a native view inside the lightweight UI: Google Maps, an ad network's banner, a vendor's video player or chat widget, anything with a native view. It lays out, scrolls and layers with the surrounding components. Native becomes the escape hatch for the few components that need it. Heavyweight gets this backwards: native is the default, and consistency is what you claw back.</p>
<p>The old joke about Java was "write once, debug everywhere." It was coined when Java's UI was AWT, a heavyweight toolkit, and that's exactly what it described. Swing fixed it. The joke still describes every heavyweight toolkit: you pay for a platform per target, test per target, debug per target, and still have an abstraction in the way. Shopify paid native costs for a decade and got none of native's control. Now it will pay them twice.</p>
<h2>Two codebases is the same mistake, twice</h2>
<p>Shopify's own post explains why their cure fails:</p>
<blockquote>
<p>"Agents can make code changes in seconds, but it takes them several minutes to test the output."</p>
</blockquote>
<p>Writing code was never the expensive part, and AI made that obvious. Everything after the code is the cost, and a second codebase doubles all of it.</p>
<h3>There are no "two platforms"</h3>
<p>"iOS and Android" is a fiction. Start with the big ones: the web and the desktop, which the next section covers. Then the iPad, Android tablets and foldables, which need layouts that adapt instead of a stretched phone UI. A serious commerce app is also expected on the watch, in widgets, in Siri and in the car. Each is a platform with its own lifecycle and its own review rules, and each needs its own code in a native project.</p>
<p>Then there's everything beyond the phone, where the interesting products are being built: <a href="https://www.codenameone.com/blog/apple-tv-and-android-tv/">TVs</a>, <a href="https://www.codenameone.com/blog/codename-one-on-xbox/">consoles</a>, <a href="https://www.codenameone.com/blog/embedded-linux-ui-in-18-mb/">embedded devices and kiosks</a>, <a href="https://www.codenameone.com/blog/ar-vr-support-simulation/">AR and VR</a>, and real-time systems on a factory floor. Two native mobile codebases reach none of them.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBJW2lPU10gLS0-IFdbd2F0Y2hPU10KICAgIEkgLS0-IENQW0NhclBsYXldCiAgICBJIC0tPiBIS1tIZWFsdGhLaXRdCiAgICBJIC0tPiBXR1tXaWRnZXRzIGFuZCBMaXZlIEFjdGl2aXRpZXNdCiAgICBJIC0tPiBNQ1tNYWMgQ2F0YWx5c3RdCiAgICBJIC0tPiBJUFtpUGFkLCBzcGxpdCB2aWV3XQogICAgQVtBbmRyb2lkXSAtLT4gV09bV2VhciBPU10KICAgIEEgLS0-IEFBW0FuZHJvaWQgQXV0b10KICAgIEEgLS0-IEhDW0hlYWx0aCBDb25uZWN0XQogICAgQSAtLT4gR09bR3JhcGhlbmVPUywgTGluZWFnZU9TLCAvZS9PUzxici8-bm8gR29vZ2xlIFBsYXkgU2VydmljZXNdCiAgICBBIC0tPiBBTVtBbWF6b24gRmlyZV0KICAgIEEgLS0-IEZEW1RhYmxldHMgYW5kIGZvbGRhYmxlc10KICAgIEEgLS0-IENOW0NoaW5lc2UgYXBwIHN0b3Jlczxici8-bm8gR29vZ2xlIGF0IGFsbF0KICAgIE9bQmV5b25kIG1vYmlsZV0gLS0-IFdFQltXZWJdCiAgICBPIC0tPiBEVFtXaW5kb3dzLCBtYWNPUywgTGludXhdCiAgICBPIC0tPiBUVltUVnMgYW5kIGNvbnNvbGVzXQogICAgTyAtLT4gRU1bRW1iZWRkZWQgYW5kIGtpb3Nrc10KICAgIE8gLS0-IFZSW0FSIGFuZCBWUl0=?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>Every box has rules a model has to know and keep current. A GrapheneOS user reports that sign-in fails. Someone has to know that Google Play Services aren't there, find the library that assumed they were, test the fix on a phone they don't own, and feed all of it back to the agent. The agent writes the patch. The developer becomes a meat proxy between users and an LLM, and with two codebases they do it twice.</p>
<p>Skipping the niche platforms is a mistake too. People on GrapheneOS, a Linux desktop or an Amazon tablet have few choices. Show up for them early and they remember, and they tell everyone. They're the early adopters who carry a product across the chasm, and the chasm is where products die. That's why we <a href="https://www.codenameone.com/blog/android-apps-everywhere-even-without-google/">support de-Googled Android officially</a>.</p>
<h3>The web and the desktop are the product now</h3>
<p>WhatsApp belongs to Meta, one of the largest engineering organizations on earth. For years WhatsApp Web needed your phone online, because it was a mirror of the phone app. In 2025 Meta replaced the native Windows client with a wrapped web version. Meta couldn't keep a desktop client in step with its phone apps. Two native codebases won't either.</p>
<p>Picture a competitor with one codebase. They finish a feature and it ships on the phone, the tablet, the desktop, the web and the watch that same day. You finished the same feature in Swift, and you're still waiting for the Kotlin version, and when it lands it doesn't behave quite like the Swift one. The desktop and the web haven't started.</p>
<h3>Testing is the bill</h3>
<p>Shopify describes its review process for each change in the rewrite: tests, a visual comparison against the running app, two adversarial AI reviewers and a human approval. Per platform. Two codebases mean two test suites, two sets of screenshot baselines, two device farms and two release trains, and every native widget adds behavior only a physical device can verify.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBGW09uZSBmZWF0dXJlXSAtLT4gU1tTd2lmdCBjb2RlXQogICAgRiAtLT4gS1tLb3RsaW4gY29kZV0KICAgIFMgLS0-IFRTW2lPUyB0ZXN0cywgZGV2aWNlIGZhcm0sPGJyLz5zY3JlZW5zaG90cywgcmV2aWV3XQogICAgSyAtLT4gVEtbQW5kcm9pZCB0ZXN0cywgZGV2aWNlIGZhcm0sPGJyLz5zY3JlZW5zaG90cywgcmV2aWV3XQogICAgVFMgLS0-IFIxW0FwcCBTdG9yZSByZXZpZXddCiAgICBUSyAtLT4gUjJbUGxheSByZXZpZXddCiAgICBGMltPbmUgZmVhdHVyZV0gLS0-IENbQ29kZW5hbWUgT25lIGNvZGVdCiAgICBDIC0tPiBUW09uZSB0ZXN0IHN1aXRlLCBvbmUgc2V0IG9mPGJyLz5zY3JlZW5zaG90IGJhc2VsaW5lc10KICAgIFQgLS0-IEJbQnVpbGRzIGZvciBpT1MsIEFuZHJvaWQsPGJyLz5kZXNrdG9wLCB3ZWIsIHdhdGNoXQ==?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>Agents make the top half worse, not better. They produce more code per day, and every line of it lands in two pipelines that need devices and humans to sign off. The throughput limit was never typing. It's verification, and Shopify chose to verify everything twice.</p>
<h3>The stores change the rules every year</h3>
<p>The App Store and Play are where mobile projects lose weeks. Apple made UIScene lifecycle support mandatory and broke third-party plugins that hooked the app delegate. Codename One users got it as a build default: we <a href="https://www.codenameone.com/blog/uiscene-on-by-default-ios-performance/">turned <code>ios.uiscene=true</code> on by default</a> after a month of testing, and nobody noticed. Same with the Xcode 26 migration, Google Play's 16 KB page requirement and every new target API level.</p>
<p>LLMs are trained on the past. Store requirements are announced for the future. The model writing your Swift today doesn't know next spring's privacy rule. A framework team that tracks those changes full-time and fixes them once for everyone matters more in the agent era.</p>
<h2>A platform should give you more than the OS</h2>
<p>A framework that wraps the OS hands you the lowest common denominator. A lightweight framework can ship what the OS doesn't have at all. Most of this week's release is exactly that:</p>
<ul>
<li><strong>A</strong> <a href="https://www.codenameone.com/blog/scheduler-gantt-and-material-pickers/"><strong>scheduler and a Gantt chart</strong></a> <strong>with resource leveling</strong>, plus Material 3 date and time pickers. Neither iOS nor Android ships a Gantt chart.</li>
<li><a href="https://www.codenameone.com/blog/subscriptions-and-paywalls-without-a-revenue-cut/"><strong>Subscriptions, paywalls and a customer center</strong></a> across Apple, Google, Amazon, Stripe and Paddle. We never touch your money, so there's no commission.</li>
<li><a href="https://www.codenameone.com/blog/bastion-hardened-bank-template/"><strong>Crypto wallets</strong></a> for Ethereum, Bitcoin and Solana in the core.</li>
<li><strong>An ORM that maps</strong> <a href="https://www.codenameone.com/blog/kafka-mail-and-records-in-your-java-backend/"><strong>Java records</strong></a> as entities, which JPA still forbids.</li>
</ul>
<p>Performance belongs here too. Codename One's <code>Base64</code> on iOS uses a portable SIMD API we built into ParparVM, our ahead-of-time compiler, and it <a href="https://www.codenameone.com/blog/ios-density-scroll-and-accessibility/">beats Apple's own implementation</a>: 379 ms to encode against Apple's 1078 ms, 365 ms to decode against 713 ms.</p>
<img src="https://www.codenameone.com/blog/simd-base64-performance.png" alt="Base64 performance on iOS: native encode 1078 ms, Codename One SIMD 379 ms; native decode 713 ms, Codename One SIMD 365 ms" style="display:block;margin:0 auto" />

<p>Security is where this matters most. A financial app needs certificate pinning, passkeys, device keys, signed requests, screens hidden from screenshots and the app switcher, jailbreak and root detection, and obfuscation with string encryption. Each has a different pitfall on each platform, and most fail silently: the app works, it isn't protected. Two codebases means getting every one of them right twice. We built them once, and our <a href="https://www.codenameone.com/blog/bastion-hardened-bank-template/">Bastion bank template</a> uses all of them in a working bank and exchange. Its Security Center shows which protections are live on that device and build, and a test fails the build if the screen ever claims more than the build delivers.</p>
<img src="https://www.codenameone.com/developer-guide/img/bastion-security-center.png" alt="The Bastion Security Center listing active protections" width="420" height="860" />

<p>Bastion's Security Center.</p>
<img src="https://www.codenameone.com/developer-guide/img/bastion-sign-in-flow.png" alt="The Bastion sign-in flow with passkeys and TOTP" style="display:block;margin:0 auto" />

<p>Sign-in with passkeys and TOTP.</p>
<h2>The full stack is where one codebase pays twice</h2>
<p>Shopify's server is a separate world with separate teams. (If Ruby is what it takes to win them over, I'll consider a Ruby port. Probably.)</p>
<p>For everyone else, the phone app, the desktop app, the web app and the server in one Java project means one set of entity classes, one debugger session that follows a request from a tap to the database, and a compile error instead of a production incident when someone renames a field. When the system changes every week, seeing all of its state in one place is the difference between moving fast and guessing. Shopify now has three codebases that have to agree on every field.</p>
<pre><code class="language-java">// shared module: used by the app AND the server
@Entity
public class Order {
    @Id public long id;
    public String customer;
    public long totalCents;
}

// backend
@RestController
public class Orders {
    @PostMapping("/orders")
    public Order place(@RequestBody Order order) {
        return repository.save(order);
    }
}
</code></pre>
<h2>More This Week</h2>
<h3>Calendars, Gantt charts and a booking app</h3>
<p>Neither iOS nor Android ships a calendar view or a Gantt chart, so every business app ends up writing one. Codename One now has a <code>Scheduler</code> with day, week, month, agenda and per-resource views:</p>
<pre><code class="language-java">DefaultScheduleModel model = new DefaultScheduleModel();
model.addItem(new ScheduleItem("review", "Design review",
        TimeMath.at(today, 13 * 60, zone), TimeMath.at(today, 14 * 60 + 30, zone))
        .setDetail("Room 2"));
Scheduler scheduler = new Scheduler(model);
scheduler.setView(Scheduler.View.WEEK);
</code></pre>
<p>And a <code>Gantt</code> with dependencies, baselines, the critical path and resource leveling that tells you what moving people around costs before you apply it:</p>
<pre><code class="language-java">if (!ResourceLeveler.findOverallocations(project).isEmpty()) {
    LevelingResult proposal = ResourceLeveler.level(project);
    if (proposal.isChanged()) {
        proposal.apply();
    }
}
</code></pre>
<img src="https://www.codenameone.com/developer-guide/img/generated/scheduler-week.png" alt="The scheduler's week view" style="display:block;margin:0 auto" />

<p>The week view.</p>
<img src="https://www.codenameone.com/developer-guide/img/generated/gantt-critical-path.png" alt="A Gantt chart with the critical path highlighted" style="display:block;margin:0 auto" />

<p>The critical path.</p>
<img src="https://www.codenameone.com/developer-guide/img/generated/gantt-leveled.png" alt="A Gantt chart after resource leveling" style="display:block;margin:0 auto" />

<p>After resource leveling.</p>
<img src="https://www.codenameone.com/developer-guide/img/generated/picker-material-date.png" alt="The Material 3 date picker" style="display:block;margin:0 auto" />

<p>The Material 3 date picker.</p>
<p>Slate, our booking template, is the same idea as a full product: clients, providers and an owner, with a slot engine that weighs rooms, buffers and travel time.</p>
<p><a href="https://www.codenameone.com/blog/release-2026-11-13/slate-desktop-demo.mp4">Download the Slate video</a>.</p>
<p>Saturday's <a href="https://www.codenameone.com/blog/scheduler-gantt-and-material-pickers/">article</a> covers both.</p>
<h3>Commerce with no commission</h3>
<p>Subscription platforms take a percentage of your revenue on top of what Apple and Google take. We never touch your money, so there's no commission. <code>CommerceManager</code> gives you entitlements, offerings, paywalls, experiments and a customer center across the App Store, Google Play, Amazon, Stripe and Paddle:</p>
<pre><code class="language-java">CommerceManager cm = CommerceManager.getInstance();
if (!cm.isEntitled("pro")) {
    Offering current = cm.getOfferings().getCurrent();
    Paywall.show(current, null);
}
</code></pre>
<img src="https://www.codenameone.com/blog/commerce-secrets-without-iap-tax/commerce.png" alt="The Commerce console" style="display:block;margin:0 auto" />

<p>Sunday's <a href="https://www.codenameone.com/blog/subscriptions-and-paywalls-without-a-revenue-cut/">commerce article</a> has refunds, retention offers, experiments, and invites.</p>
<h3>Records as entities, Kafka and mail</h3>
<p>JPA still forbids records as entities. Codename One's ORM maps them on the phone and the server, and generates a builder for each:</p>
<pre><code class="language-java">@Entity
public record Note(@Id long id, String title, int score, @Version long version) {}

Note saved = notes.save(NoteBuilder.create().title("Groceries").score(3).build());
Note changed = notes.save(NoteBuilder.of(saved).score(5).build());
</code></pre>
<p>The backend now talks to Kafka, RabbitMQ, Redis Streams, SQS and Pub/Sub through one API. Spring's <code>@KafkaListener</code> and <code>@RabbitListener</code> work as written, and a message sent inside a transaction goes out only after the commit:</p>
<pre><code class="language-java">@MessageListener(value = "orders.placed", group = "shipping", concurrency = 4)
public void placed(Order order) {
    // ship it
}
</code></pre>
<p>Mail goes out through SMTP or SES from the same transactional outbox, and server-sent events stream with resume support. Monday's <a href="https://www.codenameone.com/blog/kafka-mail-and-records-in-your-java-backend/">backend article</a> walks through it.</p>
<h3>Splat, and shipping games on Steam</h3>
<p><a href="https://www.codenameone.com/blog/release-2026-11-13/splat-desktop-demo.mp4">Download the Splat video</a>.</p>
<p>Splat is a first-person team paintball shooter: four against four, refereed by its own server, with fog, PBR materials, shadows and post processing on every GPU backend. It taught us that the art makes the game, not the engine.</p>
<img src="https://www.codenameone.com/blog/release-2026-11-13/splat-in-game.jpg" alt="A first-person view of a Splat capture the flag match" width="960" height="564" />

<p>Capture the flag.</p>
<img src="https://www.codenameone.com/developer-guide/img/splat-match-overhead.png" alt="An overhead view of a Splat match" style="display:block;margin:0 auto" />

<p>The field from above.</p>
<img src="https://www.codenameone.com/developer-guide/img/splat-mission-editor.png" alt="The Splat mission editor" style="display:block;margin:0 auto" />

<p>The mission builder.</p>
<p>Games now ship to Steam from the build cloud, and Steam features come from portable code that does nothing on other platforms:</p>
<pre><code class="language-java">if (GameServices.isAvailable()) {             // true on Steam
    GameServices.unlockAchievement("FIRST_WIN");
    GameServices.writeSave("slot1", saveBytes);
}
</code></pre>
<p>Tuesday's <a href="https://www.codenameone.com/blog/ship-your-java-game-on-steam/">article</a> has all four videos, including the mission builder on the phone.</p>
<h3>Windows kiosks and command line tools</h3>
<p>One build hint turns an app into a locked down kiosk for Windows 10 and 11 IoT Enterprise, and <code>mvn cn1:deploy-device</code> installs it over SSH. Receipt printers and scales are a serial port away:</p>
<pre><code class="language-java">SerialPort printer = Hardware.getInstance()
        .openSerial("COM3", 9600, 8, SerialPort.PARITY_NONE, 1);
</code></pre>
<p>At the other end, the console API builds command line tools that compile to a native executable with no JVM:</p>
<pre><code class="language-java">Console.print(new Table("Service", "Status", "Replicas")
        .addRow("api", Console.style("running", Console.Style.GREEN), 3)
        .render());
String env = Prompt.select("Environment", Arrays.asList("staging", "production"));
</code></pre>
<img src="https://www.codenameone.com/developer-guide/img/cli-console-output.png" alt="A table, a progress bar and a spinner in the terminal" style="display:block;margin:0 auto" />

<p>Tables, progress and spinners.</p>
<img src="https://www.codenameone.com/developer-guide/img/cli-console-select.png" alt="An arrow key selection prompt" style="display:block;margin:0 auto" />

<p>Interactive prompts.</p>
<p>Wednesday's <a href="https://www.codenameone.com/blog/windows-kiosks-and-command-line-apps/">article</a> has both.</p>
<h3>An LLM on the phone</h3>
<p><code>LlmClient.local</code> runs a GGUF model through llama.cpp on the device, behind the same API as the cloud clients. JSON output is enforced with a grammar, so it always parses:</p>
<pre><code class="language-java">LlmClient client = LocalLlmClient.isSupported()
        ? LlmClient.local(modelPath)
        : LlmClient.ollama();          // desktop development
client.chat(ChatRequest.builder()
        .addMessage(ChatMessage.user("Name three primes"))
        .build()).ready(r -&gt; Log.p(r.getText()));
</code></pre>
<p>A whisper cn1lib turns speech into text offline, so a voice memo becomes a summary without leaving the phone. Thursday's <a href="https://www.codenameone.com/blog/run-an-llm-on-the-phone/">article</a> shows how.</p>
<h2>Fix the abstraction. Don't delete it.</h2>
<p>React Native is a heavyweight toolkit, and heavyweight toolkits deserve to die. Shopify answered a bad abstraction with no abstraction, and signed up to pay for every platform, every test suite and every store rule twice, forever, on the theory that typing was the bottleneck. It never was.</p>
<p>If I were a Shopify competitor, I'd jump on this. When the leader zags, you zig. Pick up Codename One, KMP, Flutter or any other decent platform with one codebase, and put an agent to work on it. Every hour the agent spends goes into one product that ships everywhere, not into keeping two copies in step. By the time Shopify notices, you'll be so far ahead that catching up will take them years.</p>
<p>The answer to a bad abstraction is a good one: a lightweight UI you own, compiled to a native app, from one codebase, on every screen your users have.</p>
]]></content:encoded></item><item><title><![CDATA[Debug Your Dart in a Java Debugger, and JFX Central on a Phone]]></title><description><![CDATA[Flutter apps built by Codename One now debug in Dart: breakpoints by Dart line and stack traces that name your .dart files, in the standard Java debugger…]]></description><link>https://debugagent.com/debug-your-dart-in-a-java-debugger-and-jfx-central-on-a-phone</link><guid isPermaLink="true">https://debugagent.com/debug-your-dart-in-a-java-debugger-and-jfx-central-on-a-phone</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Thu, 19 Nov 2026 01:01:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/b4e6f1ad-bc54-418b-ae1c-bb4402a55fd1.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Two weeks ago we showed that Codename One can <a href="https://www.codenameone.com/blog/flutter-better-in-java/">build a Flutter app from its Dart source</a> and run it faster than Flutter's own build on most of our benchmarks. The first question from people who tried it was a fair one: what happens when something breaks? You'd be staring at a stack trace full of generated Java. That's fixed, and this post also rounds up the rest of the week's work on code you already have.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<h2>Dart stack traces in a Java debugger</h2>
<p>The Dart transpiler turns your <code>.dart</code> files into Java, and javac compiles that. Normally the class files would point at the generated Java, which you never wrote and shouldn't have to read.</p>
<p>Now they point at your Dart. While it translates, the emitter records which Dart line produced each Java line. After javac runs, the build rewrites the debug information in every class file: line numbers become Dart line numbers, the source file becomes your <code>.dart</code> file, and a JSR-45 source map is added with Dart as the default stratum. The mapping table itself is stripped, so nothing extra ships in your app.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBEW2xpYi9tYWluLmRhcnRdIC0tPnx0cmFuc3BpbGVyIG1hcmtzIGVhY2ggbGluZXwgSltHZW5lcmF0ZWQgSmF2YV0KICAgIEogLS0-fGphdmFjfCBDW0NsYXNzIGZpbGVzIHBvaW50aW5nIGF0IEphdmFdCiAgICBDIC0tPnxEYXJ0TGluZU1hcHBlciByZXdyaXRlcyBkZWJ1ZyBpbmZvfCBSW0NsYXNzIGZpbGVzIHBvaW50aW5nIGF0IG1haW4uZGFydDxici8-bGluZSBudW1iZXJzICsgU01BUCwgc3RyYXR1bSBEYXJ0XQogICAgUiAtLT4gWFtTdGFjayB0cmFjZXMgYW5kIGRlYnVnZ2VycyBzaG93IERhcnRd?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>We didn't have to build a debugger. There's no Dart debugger and no IDE plugin. The Java debugger already knows how to read line tables, source file attributes and JSR-45 source maps, which is how JSP debugging has worked for twenty years. So an exception's stack trace names <code>main.dart</code> and the Dart line, and a debugger attached to the simulator resolves breakpoints and steps through your Dart source. It happens automatically in Maven and Gradle builds of any project with <code>src/main/flutter</code>.</p>
<h2>Flutter fixes from a real port</h2>
<p>We took several real Flutter apps through the import, and each one found something. The fixes landed in the transpiler and the runtime rather than as workarounds:</p>
<ul>
<li>Generics substitution, closures that capture and modify locals, local recursive functions, tear-offs, constructor redirects and functions that return <code>Never</code>.</li>
<li>An isolate event loop, so timers and queued callbacks run in the order Dart promises.</li>
<li>Lists that remember their element type, so a wrong downcast fails where Dart says it should.</li>
<li>An <code>async</code> main that waits on <code>async*</code> streams, <code>String.runes</code>, and a long list of Flutter API and <code>dart:*</code> gaps.</li>
</ul>
<p>Three clean-room apps written for this, a club hub, a field notes app and a pet adoption app, now run as acceptance tests on every change, and Gradle builds can import Flutter projects too.</p>
<h2>A faster JavaScript port that still gets the right answer</h2>
<p>Last time I mentioned that Flutter's web build is faster than ours on some workloads, partly because it gets some of them wrong. We wanted speed without giving that up. The JavaScript port now inlines getters and setters, fuses <code>StringBuilder</code> chains that don't escape into plain string operations, keeps every array packed so the browser's JIT never sees holes, and turns virtual calls into direct ones when type flow proves there's only one target.</p>
<p>In our compute suite, string building dropped from 99 to 68 ms, quicksort by 6% and sequential array access by 5%, and the checksums still match the JVM exactly. We also measured and dropped three ideas that sounded good: scalar replacement (V8 already does it), bounds-check elimination (it was slower) and removing repeated casts (they're free). And integer division by zero now throws <code>ArithmeticException</code> on the web, as Java says it should, instead of quietly returning zero.</p>
<h2>JFX Central on an iPhone</h2>
<p><a href="https://www.jfx-central.com/">JFX Central</a> is the JavaFX community's hub: people, libraries, apps, books and videos, written in JavaFX by people who know JavaFX very well. We ported it to phones on top of our JavaFX compatibility layer, and this is it running on an iPhone:</p>
<p><a href="https://www.codenameone.com/blog/release-2026-11-06/JFXCentral-demo.mp4">Download the JFX Central video</a>.</p>
<p>It doesn't feel as polished as an app written for Codename One from the start. But it's a real JavaFX codebase, with bindings, cells, CSS and remote images everywhere, running on a phone, and getting there filled real gaps in the layer:</p>
<ul>
<li><code>ListProperty</code> listeners fire on content changes, and <code>ObservableValue.map</code>, <code>flatMap</code> and <code>orElse</code> work.</li>
<li>Remote images load in the background through the same cache as <code>URLImage</code>, and the layout updates when they arrive.</li>
<li><code>Label</code> text wraps onto several lines, and <code>ImageView</code> honors <code>-fx-fit-width</code>, <code>-fx-fit-height</code> and <code>-fx-preserve-ratio</code> from CSS.</li>
<li>Cells no longer try to set a bound <code>visible</code> property, which used to throw.</li>
</ul>
<p>The <a href="https://www.codenameone.com/developer-guide/desktop-interop/">desktop compatibility chapter</a> covers what carries over from JavaFX and Swing, and the <a href="https://www.codenameone.com/developer-guide/flutter-interop/">Flutter chapter</a> covers the import.</p>
<p>That's the week. Friday starts the next one.</p>
]]></content:encoded></item><item><title><![CDATA[Port Your Spring Code With Fewer Edits, and Libraries That Bring Their Own Server]]></title><description><![CDATA[The Codename One backend now takes more Spring code as it is: structured logging, typed JSON without reflection, CORS, content negotiation, status…]]></description><link>https://debugagent.com/port-your-spring-code-with-fewer-edits-and-libraries-that-bring-their-own-server</link><guid isPermaLink="true">https://debugagent.com/port-your-spring-code-with-fewer-edits-and-libraries-that-bring-their-own-server</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Wed, 18 Nov 2026 01:01:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/da5063a0-5169-4343-9bea-3101195f5dee.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The Codename One backend compiles your server to a native executable that starts in 40 ms and idles in about 9 MB. The catch has always been porting: real Spring services lean on dozens of small conveniences, and every one that's missing is an edit. This round we took real services across and fixed what they tripped on, so most of this post is code that now moves over with nothing but its imports changed.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<h2>A Spring controller, mostly unchanged</h2>
<p>Here's a typical order endpoint. Every line of the body works on the backend now:</p>
<pre><code class="language-java">@RestController
@CrossOrigin(origins = "https://shop.example.com", allowCredentials = true)
public class OrderController {
    private static final Logger LOG = Logger.getLogger(OrderController.class);

    @Autowired
    private OrderRepository orders;

    @PostMapping(value = "/orders", consumes = "application/json", produces = "application/json")
    public Order place(@RequestBody Order order) {
        if (order.lines.isEmpty()) {
            throw new ResponseStatusException(400, "An order needs at least one line");
        }
        MDC.put("customer", order.customer);
        try {
            LOG.info("Placing order with {} lines", order.lines.size());
            return orders.save(order);
        } finally {
            MDC.remove("customer");
        }
    }
}
</code></pre>
<p>What changed to make that work:</p>
<ul>
<li><code>consumes</code> <strong>and</strong> <code>produces</code> are checked. A request with the wrong <code>Content-Type</code> gets a 415, and one whose <code>Accept</code> header can't be satisfied gets a 406, before your method runs.</li>
<li><code>@CrossOrigin</code> answers preflight requests and sets the CORS headers, with the same defaults as Spring: any origin, a 30 minute <code>max-age</code>, and credentials only when you ask.</li>
<li><code>ResponseStatusException</code> picks the status and the message of the error response, so validation code doesn't need a custom exception handler.</li>
<li><code>Logger</code> <strong>and</strong> <code>MDC</code> in <code>com.codename1.backend.log</code> use <code>{}</code> placeholders, levels from <code>logging.level.*</code> properties as in Spring Boot, and a per-thread diagnostic context for request and customer ids.</li>
</ul>
<p>The imports point at <code>com.codename1.backend</code> instead of <code>org.springframework</code>, and that's the edit.</p>
<h2>JSON with your own classes, and no reflection</h2>
<p>Controllers already turned plain classes into JSON. Now your own code can do the same anywhere, through <code>Json</code>:</p>
<pre><code class="language-java">public class Order {
    public long id;
    public String customer;
    @JsonProperty("placed_at")
    public Date placedAt;
    public List&lt;OrderLine&gt; lines = new ArrayList&lt;OrderLine&gt;();
}

Order order = Json.read(body, Order.class);
List&lt;Order&gt; history = Json.readList(response, Order.class);
String text = Json.write(order);
</code></pre>
<p>The codecs are generated at build time for the classes you use, so there's no reflection at run time and nothing for the native build to strip away. <code>Json.convert</code> turns an already parsed map into a typed object, which helps when you only know the type after you've looked at a field.</p>
<h2>More of the JDK your code already uses</h2>
<p>The backend runs on our own class library, so every missing JDK class used to be a rewrite. These are now there:</p>
<pre><code class="language-java">BigDecimal total = BigDecimal.ZERO;
for (OrderLine line : order.lines) {
    total = total.add(line.price.multiply(BigDecimal.valueOf(line.quantity)));
}
YearMonth billing = YearMonth.now();
LocalDate due = LocalDate.now().with(TemporalAdjusters.lastDayOfMonth());

if (!order.customer.matches("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+")) {
    throw new ResponseStatusException(400, "Not an email address");
}

Semaphore gate = new Semaphore(4);                       // at most four calls out at once
ConcurrentLinkedQueue&lt;Order&gt; outbox = new ConcurrentLinkedQueue&lt;Order&gt;();
</code></pre>
<p><code>String.matches</code>, <code>split</code> and <code>replaceAll</code> work, and so does <code>java.util.regex</code>, which the build moves to our own regex engine for you. <code>Flow</code> and <code>InetAddress</code> are there too.</p>
<p>The HTTP client can insist on HTTP/2 with <code>setRequireHttp2(true)</code>. A streaming XML pull parser reads feeds and SOAP replies, and it refuses <code>DOCTYPE</code>, so XML external entity attacks have nothing to hook into. XML property lists and an image header reader for PNG, JPEG, GIF and WebP round it out.</p>
<h2>Data and security</h2>
<p>The ORM learned <code>@Lob</code> and the <code>insertable</code> and <code>updatable</code> flags on <code>@Column</code>, and <code>CrudRepository</code> gained more of Spring Data's methods. On the security side, a <code>{sha256}</code> password encoder lets you import a user table hashed by an older system without forcing every user to reset, and remember-me devices keep people signed in on the browsers they trust.</p>
<h2>Libraries that bring their own server</h2>
<p>Most features need a server too. Comments need a table and an endpoint. Push needs a place to store tokens. A payment flow needs a webhook. Until now a cn1lib could give you the client half, and the README told you what to write on the server. Everyone wrote it a little differently, and a little wrong.</p>
<p>Now a library can ship both halves, and the server half wires itself in.</p>
<h2>What the library carries</h2>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBMW25vdGVsaWIuY24xbGliXSAtLT4gQ1tDbGllbnQgaGFsZjxici8-VUksIEFQSSBjYWxsc10KICAgIEwgLS0-IFpbYmFja2VuZC56aXA8YnIvPmNvbnRyb2xsZXJzLCBzZXJ2aWNlcywgZW50aXRpZXMsIGRiL21pZ3JhdGlvbl0KICAgIEMgLS0-IEFbWW91ciBhcHBdCiAgICBaIC0tPiBTW1lvdXIgc2VydmVyIGJ1aWxkXQogICAgUyAtLT4gV1tSb3V0ZXMsIGJlYW5zLCBkYXRhIGFjY2VzcyBhbmQgbWlncmF0aW9uczxici8-d2lyZWQgYXMgaWYgdGhlIHNlcnZlciBjb21waWxlZCB0aGVtXQ==?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>The Maven cn1lib archetype now has a <code>backend</code> module. Put the server classes in <code>backend/src/main/java</code> and build. The <code>.cn1lib</code> then carries them as <code>backend.zip</code> next to the client parts. With Gradle the sources go in <code>src/backend/java</code> and publish as <code>&lt;library&gt;-backend</code>.</p>
<p>On the server that uses it, you add one dependency:</p>
<pre><code class="language-xml">&lt;dependency&gt;
    &lt;groupId&gt;com.example&lt;/groupId&gt;
    &lt;artifactId&gt;notelib-backend&lt;/artifactId&gt;
    &lt;version&gt;1.0&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>
<p>That's it. The library's <code>@RestController</code> classes get routes, its <code>@Component</code> and <code>@Service</code> classes become beans your code can inject, its entities and repositories get their data access, and its <code>db/migration</code> scripts run with yours. All of it is wired at build time, like your own code, so there's no classpath scanning at startup.</p>
<p>Two rules keep this predictable. A jar only takes part if it carries the marker resource <code>META-INF/codenameone/backend-library</code>; any other jar is an ordinary dependency and nothing in it gets wired. And if your server defines a class with the same name as the library's, yours wins, so you can override any piece you don't like.</p>
<p>A library can also be server-only: a plain jar that depends on <code>codenameone-backend</code> with <code>provided</code> scope and carries the marker.</p>
<p>The <a href="https://www.codenameone.com/developer-guide/backend-beans/#backend-libraries">backend libraries section</a> covers packaging, and the <a href="https://www.codenameone.com/developer-guide/backend-web/">backend web chapter</a> covers JSON, the client and the rest.</p>
<p>Tomorrow: <a href="https://www.codenameone.com/blog/debug-dart-in-a-java-debugger/">Debug Your Dart in a Java Debugger, and JFX Central on a Phone</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Packaging Java Apps for Xbox Developer Mode, and Why Consoles Need Help]]></title><description><![CDATA[Codename One can now package an app or game for Xbox Developer Mode with one build hint. That covers the open part of a console port. Shipping on Xbox…]]></description><link>https://debugagent.com/packaging-java-apps-for-xbox-developer-mode-and-why-consoles-need-help</link><guid isPermaLink="true">https://debugagent.com/packaging-java-apps-for-xbox-developer-mode-and-why-consoles-need-help</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Tue, 17 Nov 2026 01:01:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/9e11594c-367b-4a64-8ebf-dc0494fc483c.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Codename One targets iOS, Android, macOS, Windows, Linux, the web, watches, TVs and now embedded boards. There's one major category missing: game consoles.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>The technical side looks manageable. A console is a computer with a GPU and a controller, and we already render through Metal, Direct3D and OpenGL ES and map controllers to game actions. They're hard because everything about them sits behind a non-disclosure agreement. This week we took the first step that doesn't need one.</p>
<h2>One build hint</h2>
<p>Any retail Xbox can be switched into Developer Mode, which lets you sideload UWP apps for testing. Codename One can now build that package:</p>
<pre><code class="language-properties">codename1.arg.windows.xbox=true
</code></pre>
<p>That builds the native Windows port as a UWP app and packages it as a signed <code>.msix</code>. If you don't provide a certificate, the build makes a self-signed development one next to the package. Then:</p>
<ol>
<li>Install Dev Home on the console and turn on Developer Mode and Remote Access.</li>
<li>Open the Device Portal at <code>https://&lt;console&gt;:11443</code> in a browser.</li>
<li>Under Home, add the <code>.msix</code> and pick the <code>.cer</code> the build produced.</li>
</ol>
<p>You can try the same package on a Windows PC first: import the certificate into the Local Machine's Trusted People store, then run <code>Add-AppxPackage</code> on the <code>.msix</code>.</p>
<h2>What changes on a console</h2>
<p>A console app isn't a desktop app with a bigger screen. Three things had to change in the port:</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBHW1lvdXIgZ2FtZSBvciBhcHA8YnIvPmNvbS5jb2RlbmFtZTEuZ2FtaW5nLCBVbml0eSBpbXBvcnQsIG9yIGFueSBDTjEgYXBwXSAtLT4gUFtOYXRpdmUgV2luZG93cyBwb3J0XQogICAgUCAtLT58d2luZG93cy54Ym94PXRydWV8IFVbVVdQIGFwcCBjb250YWluZXI8YnIvPkNvcmVXaW5kb3csIG5vIGRlc2t0b3Agd2luZG93XQogICAgVSAtLT4gUltEaXJlY3QyRCBpbnRvIGEgRGlyZWN0M0Qgc3dhcCBjaGFpbl0KICAgIFUgLS0-IElbQ29udHJvbGxlcjogRC1wYWQgYW5kIHN0aWNrIHRvIGRpcmVjdGlvbnM8YnIvPkEgdG8gZmlyZSwgQiB0byBiYWNrXQogICAgVSAtLT4gU1tUViBvdmVyc2NhbiBhcyB0aGUgZGlzcGxheSBzYWZlIGFyZWFd?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p><strong>The app container.</strong> There's no desktop window. The port runs on a <code>CoreWindow</code> and draws with Direct2D into a Direct3D swap chain. The build links against <code>WindowsApp.lib</code> alone, which proves at build time that every system call the port makes is allowed inside the container. If something isn't allowed, the build fails instead of the console.</p>
<p><strong>The controller.</strong> The D-pad and the left stick arrive as the four directions, A as fire and B as back, through the same <code>Display.getGameAction()</code> your game already uses for arrow keys. A game written with <code>com.codename1.gaming</code> or imported from a Unity 2D project doesn't need console-specific input code.</p>
<p><strong>The TV.</strong> Televisions crop the edges of the picture. The visible area the console reports comes through <code>Display.getDisplaySafeArea()</code>. Use it to keep the score and the menus where people can see them.</p>
<p>Here's how a game reads input, unchanged from phone to desktop to console:</p>
<pre><code class="language-java">public void keyPressed(int keyCode) {
    switch (Display.getInstance().getGameAction(keyCode)) {
        case Display.GAME_LEFT:  player.moveLeft();  break;
        case Display.GAME_RIGHT: player.moveRight(); break;
        case Display.GAME_FIRE:  player.jump();      break;
    }
}
</code></pre>
<h2>Where it stands</h2>
<p>This is experimental, and the limits are real.</p>
<ul>
<li>CI cross-compiles the target on Linux, installs the package on a Windows machine and checks that it reaches its first frame inside the app container. We haven't run it on a real Xbox yet. Controller input and overscan only exist on the console, so both are untested.</li>
<li>Some things the desktop port does aren't available in the container: secondary windows, menus, the tray, native text editors, file dialogs, the clipboard, printing, the camera, audio recording and the share sheet. The only file root is the app's local folder.</li>
<li>Most important: <strong>Developer Mode is a test sandbox, not a store.</strong> You can't sell a game this way. Retail Xbox titles are built with Microsoft's Game Development Kit under a publishing agreement.</li>
</ul>
<h2>Why consoles need a different kind of help</h2>
<p>Every console platform holder, Microsoft, Sony and Nintendo, keeps its SDK, its development hardware and its certification process behind an NDA. You get access by signing a publishing or developer agreement, and what you learn under it can't be published. That's a hard wall for an open source project. We can't put code that uses those SDKs in a public repository, and we can't even describe the APIs in a public issue.</p>
<p>So a console port has two halves:</p>
<ul>
<li><strong>The portable half</strong> belongs in Codename One, in the open: the windowless host, controller mapping, the safe area and game code that runs anywhere. That's what this week's Xbox work builds and exercises.</li>
<li><strong>The platform half</strong> depends on each SDK. It would have to stay proprietary and be available only to developers who hold a license for that console's SDK.</li>
</ul>
<p>We'd like to get there. If you work at a platform holder, at a studio with console agreements, or you know the right person to talk to, please <a href="https://www.codenameone.com/contact-us.html">reach out</a>. A Java game on a console, written once and also shipped to phones, desktop and the web, is something I think a lot of small studios would use.</p>
<p>The <a href="https://www.codenameone.com/developer-guide/working-with-windows/#xbox-developer-mode">Windows chapter</a> covers building and installing, and the <a href="https://www.codenameone.com/developer-guide/gaming-consoles/">gaming consoles appendix</a> tracks the state of console work.</p>
<p>Tomorrow: <a href="https://www.codenameone.com/blog/cn1libs-with-a-server-side/">Port Your Spring Code With Fewer Edits, and Libraries That Bring Their Own Server</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Real-Time Java: Control Loops the Garbage Collector Never Stops]]></title><description><![CDATA[What real time actually means, why a garbage collected language has trouble with it, and how Codename One runs a 1 kHz Java control loop on PREEMPT_RT…]]></description><link>https://debugagent.com/real-time-java-control-loops-the-garbage-collector-never-stops</link><guid isPermaLink="true">https://debugagent.com/real-time-java-control-loops-the-garbage-collector-never-stops</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Mon, 16 Nov 2026 01:01:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/700e9cc5-394d-42e4-a646-c8d895b48d53.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In Friday's <a href="https://www.codenameone.com/blog/embedded-linux-ui-in-18-mb/">embedded Linux post</a> I promised the hardcore part. A device with a touchscreen is one thing. A device that drives a motor, reads a force sensor or balances something is another, because the code that does that has deadlines. Miss one and the motor stutters, the reading is stale, or the thing falls over.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>The standard advice is that you can't write that code in Java. The garbage collector will stop your thread at the worst moment. This post explains what real time actually requires, why that advice is usually right, how real-time JVMs like JamaicaVM and the RTSJ got around it, and the approach we took because we own the VM.</p>
<h2>What "real time" means</h2>
<p>Real time doesn't mean fast. It means <em>on time, every time</em>. A loop that usually takes 50 microseconds and occasionally takes 30 milliseconds is fast and useless. A loop that always finishes within 900 microseconds of a 1-millisecond period is slow and perfect.</p>
<p>A few terms you'll see everywhere:</p>
<ul>
<li><strong>Period.</strong> How often the loop runs. A motor drive might run every millisecond (1 kHz).</li>
<li><strong>Deadline.</strong> When the work for one period has to be done, usually by the start of the next.</li>
<li><strong>Release latency.</strong> How late the thread actually woke up compared to when it was scheduled. This is what the operating system and the runtime add.</li>
<li><strong>Jitter.</strong> How much that latency varies. Steady lateness can be compensated for; jitter can't.</li>
<li><strong>Worst case.</strong> The only number that matters. An average of 5 microseconds with a worst case of 20 milliseconds is a 20 millisecond system.</li>
</ul>
<p>Then the three flavors:</p>
<ul>
<li><strong>Hard real time.</strong> A missed deadline is a failure, possibly a dangerous one. Airbags, flight controls, pacemakers. These are certified against standards like IEC 61508, ISO 26262 or DO-178C, and usually run on an RTOS.</li>
<li><strong>Firm real time.</strong> A missed deadline makes that result worthless, but the system survives. A motor controller that holds its last output for one cycle. Most industrial and robotics loops live here.</li>
<li><strong>Soft real time.</strong> Late results are worth less but still worth something. Audio, video, games.</li>
</ul>
<p>We target <strong>firm</strong> real time on a PREEMPT_RT Linux kernel. That's an important line, so I'll say it plainly: this is not a certified hard real-time system, and a loop whose failure can hurt someone still needs an independent safety mechanism like a hardware watchdog or an interlock. If you need hard, certified real time, that's work we'd like to do with you, but it isn't what shipped this week.</p>
<h2>Why this is hard for a high-level language</h2>
<p>A C programmer on PREEMPT_RT gets a lot for free. Set <code>SCHED_FIFO</code>, lock memory, pin a core, don't call <code>malloc</code> in the loop. The kernel does the rest, and since kernel 6.12 PREEMPT_RT is part of mainline Linux.</p>
<p>A managed language adds four problems on top of that:</p>
<ol>
<li><strong>The garbage collector.</strong> Most collectors stop every thread at some point, if only to read their stacks. For a few milliseconds your control loop simply doesn't exist.</li>
<li><strong>Allocation.</strong> Every <code>new</code> adds work for the collector, and an allocating thread can be told to wait while it catches up. String concatenation, boxing an <code>int</code> into an <code>Integer</code> and collections of boxed numbers all allocate where you don't see it.</li>
<li><strong>The JIT.</strong> On a JVM, the first few thousand runs of your loop are interpreted, then compiled, sometimes thrown away and compiled again. Each of those moments costs time you didn't budget for.</li>
<li><strong>Hidden slow paths.</strong> Initializing a class on first use, building a stack trace for an exception, a page fault on memory touched for the first time. All legal Java, all disastrous in a 1 ms budget.</li>
</ol>
<p>Then there's <strong>priority inversion</strong>, which hits every language: a low priority thread holds a lock the real-time thread needs, a medium priority thread preempts the holder, and the real-time thread waits on something that isn't even running.</p>
<h2>How we solve it</h2>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IFRCCiAgICBBW1lvdXIgUmVhbHRpbWVUYXNrXSAtLT4gQntCdWlsZCB0aW1lfQogICAgQiAtLT58bmV3LCBhcnJheXMsIGJveGluZywgc3RyaW5nIGNvbmNhdCBpbiBjeWNsZXwgWFtCdWlsZCBmYWlscywgbmFtZXMgbWV0aG9kIGFuZCBsaW5lXQogICAgQiAtLT58Y2xlYW58IENbUGFycGFyVk06IGFoZWFkLW9mLXRpbWUgQywgbm8gSklUXQogICAgQyAtLT4gRFtTQ0hFRF9GSUZPIHRocmVhZCwgcGlubmVkIGNvcmUsIG1sb2NrXQogICAgRCAtLT4gRXtFdmVyeSBwZXJpb2R9CiAgICBFIC0tPiBGW2N5Y2xlIHJ1bnMgb24gYW4gYWJzb2x1dGUgY2xvY2tdCiAgICBHW0dhcmJhZ2UgY29sbGVjdG9yXSAtLi0-fHJlbGVhc2VzIFJUIHRocmVhZCBhdCBzdGFjayBzY2FuLCBubyBzdG9wLXRoZS13b3JsZCBwaGFzZXN8IEYKICAgIEYgLS0-fGFsbG9jYXRpb24gdGhlIGJ1aWxkIGNvdWxkIG5vdCBzZWV8IFlbUmVhbHRpbWVBbGxvY2F0aW9uRXJyb3IsIHRocmVhZCBmYWlscyBzYWZlbHld?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>Each problem gets its own answer:</p>
<p><strong>No JIT.</strong> Codename One already compiles your Java ahead of time to C through ParparVM. The code that runs in period one is the code that runs in period one million.</p>
<p><strong>The collector never stops a real-time thread.</strong> An ordinary thread pauses for a moment while the collector reads its stack. A real-time thread is released immediately, and its references stay visible to the collector through the write barrier. While any real-time thread runs, the collector never enters its stop-the-world phases. This only works because we own the VM.</p>
<p><strong>Allocation fails the build.</strong> The translator follows every call <code>cycle()</code> can make and fails the build on <code>new</code>, array creation, boxing and string concatenation, naming the method and the line. An allocation you mean to make, on a fault path for example, gets <code>@AllocationAllowed</code>. Anything the build can't see, like a call through an interface with several implementations, is caught at run time and stops the thread with a <code>RealtimeAllocationError</code>. Catching that error doesn't switch the check off.</p>
<p><strong>Priority inheritance.</strong> Monitors use priority-inheriting mutexes on Linux, so a low priority lock holder is raised until it lets go. Better still, hand data across through preallocated buffers and <code>java.util.concurrent.atomic</code>, and don't share a lock at all.</p>
<p><strong>Memory and cores.</strong> <code>Realtime.lockMemory()</code> locks the process into RAM so nothing pages out mid-cycle. Pinning a thread to a core moves the process's other threads off it by default. <code>Realtime.setMemoryLimit()</code> caps the process's resident memory. Real-time threads are exempt because they don't allocate, so a leak in the UI makes an ordinary allocation fail fast instead of slowing everything down while the collector struggles.</p>
<h2>The code</h2>
<p>Here's a 1 kHz motor loop. Everything it needs is allocated before the first period, <code>setup()</code> may allocate, and <code>cycle()</code> may not:</p>
<pre><code class="language-java">class MotorLoop extends RealtimeTask {
    private final double[] samples = new double[64];
    private final double[] gains = new double[64];
    private PwmChannel pwm;
    private boolean failed;

    public void setup() {
        try {
            pwm = Hardware.getInstance().openPwm(0, 0);
        } catch (HardwareException e) {
            failed = true;
        }
    }

    public void cycle() {
        if (failed) {
            return;
        }
        double out = 0;
        for (int i = 0; i &lt; samples.length; i++) {
            out += samples[i] * gains[i];
        }
        try {
            pwm.setDutyCycle(out);
        } catch (HardwareException e) {
            failed = true;   // no allocation on this path
        }
    }

    public void periodsMissed(int count) {
        // the loop overran; hold the output, count it, alarm if it persists
    }
}

RealtimeThread loop = Realtime.getInstance().start("motor",
        new RealtimeParameters()
            .setPeriodNanos(1000000)   // 1 kHz
            .setPriority(80)           // SCHED_FIFO 1..99
            .setCpu(3),                // pin to core 3
        new MotorLoop());
</code></pre>
<p>Two details there are worth a second look. The period runs on an absolute clock, so it doesn't drift with the time <code>cycle()</code> takes. And when the loop overruns, you get <code>periodsMissed(n)</code> instead of a burst of late cycles trying to catch up, which is what you want from a motor: hold, don't lurch.</p>
<h2>Trust the numbers, not the promise</h2>
<p>The guide's advice is the same as mine: don't believe a real-time claim until you've measured it on your board under load. Every thread keeps statistics for exactly that:</p>
<pre><code class="language-java">RealtimeStatistics stats = loop.getStatistics();
Log.p("scheduling applied: " + loop.isSchedulingApplied());
Log.p("p99.99 latency ns: " + stats.getLatencyPercentileNanos(0.9999));
Log.p(stats.toString());
</code></pre>
<p>You get cycles, missed periods, maximum and mean release latency, execution time, allocation violations and a 16 bucket latency histogram. Log <code>isSchedulingApplied()</code> at startup too. A loop that silently runs at normal priority because the service lacks <code>CAP_SYS_NICE</code> looks perfect on the bench and misses deadlines in the field. If you'd rather fail loudly, <code>setSchedulingRequired(true)</code> does that.</p>
<p>I'm not publishing latency figures here on purpose. Latency on PREEMPT_RT is set by the kernel and the hardware, and a number from our CI runner says nothing about your board. CI does run a 1 kHz loop while the main thread allocates as hard as it can, and fails if a release is ever late beyond a bound. Run the same check (<code>vm/backend/demo/rtcheck</code> in the repository) on your own hardware and you'll have a number that means something.</p>
<h2>Where this goes next</h2>
<p>On a phone, in the simulator or on desktop, the same task runs on an ordinary thread without guarantees, so you can develop and test the logic anywhere. On Linux with PREEMPT_RT and the right capabilities, the collector stops getting in the way. The kernel still sets the latency.</p>
<p>This is the lightweight end of real time: firm deadlines on a general purpose OS. The next level is hard real time on a proper RTOS, with certification. We don't see a blocker in the design, but hard real time with certification is a big investment, and it only makes sense with a customer behind it. If you build products that need it, I want to hear from you.</p>
<p>The <a href="https://www.codenameone.com/developer-guide/realtime/">real-time chapter</a> has the full API, the parameters, what each platform supports and how to set up a board.</p>
<p>Tomorrow: <a href="https://www.codenameone.com/blog/codename-one-on-xbox/">Packaging Java Apps for Xbox Developer Mode, and Why Consoles Need Help</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Pulse: Heart Rate Zones From the Watch to the Trainer's Screen]]></title><description><![CDATA[Pulse is a full-stack gym and studio template in Java built around health data: a member's Apple Watch, Wear OS watch or Bluetooth chest strap feeds a…]]></description><link>https://debugagent.com/pulse-heart-rate-zones-from-the-watch-to-the-trainer-s-screen</link><guid isPermaLink="true">https://debugagent.com/pulse-heart-rate-zones-from-the-watch-to-the-trainer-s-screen</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Sun, 15 Nov 2026 01:01:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/08e42f3d-bf2e-44bd-9543-5e72a255ce58.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A spin class with a screen on the wall showing every rider's heart rate zone is the kind of feature studios pay a lot for. It usually means a vendor's hardware, a vendor's app and a monthly fee per location. Underneath, it's three hard integrations: reading a watch or a chest strap in real time, getting that reading off the phone fast enough to matter, and doing it on iOS and Android, which store health data in two completely different places.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>Pulse is a studio template where that's already done, in one Java project you own the source of. The member's phone records the class, the trainer's phone shows the room. You can generate it from the <a href="https://www.codenameone.com/initializr/">Initializr</a> as <em>Fitness studio</em>, under your own name and package, and the source is MIT-0.</p>
<p><a href="https://www.codenameone.com/blog/release-2026-11-06/pulse-phone-trainer.mp4">Download the trainer video</a>.</p>
<h2>From the wrist to the wall</h2>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBXW0FwcGxlIFdhdGNoIG9yIFdlYXIgT1M8YnIvPnZpYSBIZWFsdGhLaXQgLyBIZWFsdGggQ29ubmVjdF0gLS0-IFNbV29ya291dCBzZXNzaW9uPGJyLz5vbiB0aGUgbWVtYmVyJ3MgcGhvbmVdCiAgICBIW0JsdWV0b290aCBjaGVzdCBzdHJhcDxici8-SGVhcnQgUmF0ZSBwcm9maWxlXSAtLT4gUwogICAgUyAtLT58bGF0ZXN0IGJlYXR8IEJbKFB1bHNlIGJhY2tlbmQ8YnIvPkhlYXJ0UmF0ZXMsIGluIG1lbW9yeSldCiAgICBCIC0tPnx6b25lIDEgdG8gNSwgbGl2ZSBjaGFubmVsfCBUW1RyYWluZXIncyBwaG9uZV0KICAgIFMgLS0-fHNhdmVkIHdvcmtvdXR8IEtbSGVhbHRoS2l0IC8gSGVhbHRoIENvbm5lY3RdCiAgICBLIC0tPnxoaXN0b3J5fCBQW1Zpc2l0cywgbWludXRlcywgcG9pbnRzXQ==?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>When a member checks into a class, the app asks for permission once, then opens a workout session that collects heart rate. On iOS that's a HealthKit workout, which also brings in a paired Apple Watch; on Android it's Health Connect. It's the same code on both:</p>
<pre><code class="language-java">Health.getInstance().getStore().requestAuthorization(
        HealthAccess.write(HealthDataType.WORKOUT),
        HealthAccess.read(HealthDataType.HEART_RATE),
        HealthAccess.write(HealthDataType.HEART_RATE)).onResult((asked, refused) -&gt; {
    WorkoutConfiguration config = new WorkoutConfiguration()
            .setActivityType(WorkoutActivityType.CYCLING)
            .setTitle("Morning Spin")
            .addCollectedType(HealthDataType.HEART_RATE);
    Health.getInstance().getWorkouts().startSession(config).onResult((workout, failed) -&gt; {
        if (workout != null) {
            workout.addListener(workoutListener);
            workout.start();
            pairStrap(workout);
        }
    });
});
</code></pre>
<h2>Chest straps over Bluetooth</h2>
<p>Plenty of members train with a chest strap instead of a watch, and the strap is more accurate anyway. Every strap on the market speaks the standard Bluetooth Heart Rate profile, so Pulse scans for that profile, connects to the first one it finds and feeds it into the same workout session, which means the strap's beats end up in the member's health history too:</p>
<pre><code class="language-java">HealthSensors sensors = Health.getInstance().getSensors();
sensors.startScan(new SensorScanSettings()
        .addProfile(HealthSensorProfile.HEART_RATE)
        .setTimeoutMillis(20000), new SensorDiscoveryListener() {
    public void sensorDiscovered(HealthSensor sensor) {
        SensorSessionOptions options = new SensorSessionOptions()
                .setAutoReconnect(true)
                .setWorkoutSession(workout);
        sensors.connect(sensor, HealthSensorProfile.HEART_RATE, options)
                .onResult((strap, failed) -&gt; {
                    if (strap != null) {
                        strap.addListener(strapListener);
                    }
                });
    }

    public void scanFailed(HealthException error) {
    }
});
</code></pre>
<p>Auto reconnect matters more than it looks. A strap drops off for a second whenever someone wipes their chest, and you don't want the trainer's screen to lose them for the rest of the class.</p>
<p>A strap reports every beat. A watch, through the platform, reports running statistics instead, so Pulse reads whichever one it has:</p>
<pre><code class="language-java">public void sensorSample(SensorSession session, HealthSample sample) {
    if (sample instanceof QuantitySample
            &amp;&amp; HealthDataType.HEART_RATE.equals(sample.getType())) {
        beat((int) Math.round(((QuantitySample) sample)
                .getValue(HealthUnit.COUNT_PER_MINUTE)));
    }
}

public void workoutStatisticsUpdated(WorkoutSession session, HealthDataType type) {
    HealthQuantity average = session.getStatistic(HealthDataType.HEART_RATE,
            AggregateMetric.AVERAGE);
    if (average != null) {
        beat((int) Math.round(average.getValue(HealthUnit.COUNT_PER_MINUTE)));
    }
}
</code></pre>
<h2>Zones on the trainer's screen</h2>
<p><code>beat()</code> sends the reading to the studio's backend. The server keeps only the latest reading per member, in memory, and turns it into a zone: the reading's share of 220 minus the member's age, in fifths starting at 50%. Zone 1 is a warm-up, zone 5 is everything they've got. The trainer's phone gets the zones over a live channel, so the room view updates as people push, and a trainer can see who's coasting and who needs to back off.</p>
<p>Individual readings are never written to the database. A reading matters for a few seconds; the workout, which is kept, arrives whole when the class ends, and it's also saved to the member's own HealthKit or Health Connect store.</p>
<h2>Reading history back</h2>
<p>Past workouts, including ones recorded by other apps, feed the member's progress screen. One query works on both platforms:</p>
<pre><code class="language-java">SampleQuery query = new SampleQuery().addType(HealthDataType.WORKOUT)
        .setTimeRange(HealthTimeRange.lastDays(14)).setLimit(30)
        .setSortDescending(true);
Health.getInstance().getStore().readSamples(query).onResult((samples, failed) -&gt; {
    // turn workouts into visits, minutes and points
});
</code></pre>
<p>Workouts become points, streaks and badges, and friends can send kudos, which is the part that keeps people coming back in January.</p>
<h2>Health data is regulated data</h2>
<p>Heart rate is health data. In the EU it's special-category data under GDPR, in the US it can fall under HIPAA depending on who holds it, and Apple and Google both have their own rules for apps that read HealthKit or Health Connect, including what you may store and what you must disclose. Pulse is built to stay on the right side of that by default: it asks only for the types it uses and keeps live readings out of the database. The <a href="https://www.codenameone.com/developer-guide/pulse-implementors-guide/">implementor's guide</a> lists what you still have to do yourself before you ship, and you should read that part with whoever handles your privacy policy.</p>
<h2>The rest of the studio</h2>
<p>Health is the part this post is about, but Pulse is a whole studio app. The server decides which roles an account has, so the same install becomes a member app at home and a trainer app on the coach's phone:</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBCWyhQdWxzZSBiYWNrZW5kPGJyLz5ib29raW5ncywgYmlsbGluZywgcG9pbnRzKV0gLS0tIE1bTWVtYmVyPGJyLz5ib29rLCBwYXNzLCB3b3Jrb3V0cywgZnJpZW5kc10KICAgIEIgLS0tIFRbVHJhaW5lcjxici8-bGl2ZSBjbGFzcywgcm9zdGVyLCBsZWFkZXJib2FyZF0KICAgIEIgLS0tIERbRnJvbnQgZGVzazxici8-dGFibGV0IGtpb3NrLCBjaGVjay1pbl0KICAgIEIgLS0tIE9bT3duZXI8YnIvPnJldmVudWUsIHV0aWxpc2F0aW9uLCBjYW1wYWlnbnNd?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p><strong>Members</strong> book classes, join waitlists, add their kids to a household, and walk in with a door pass: a QR code that rotates, so an old screenshot stops working, or an NFC tap.</p>
<p><a href="https://www.codenameone.com/blog/release-2026-11-06/pulse-phone-member.mp4">Download the member video</a>.</p>
<p><strong>Owners</strong> get the desktop from the same codebase: takings, busy hours, under-filled classes, members who are about to churn, plans and pricing, campaigns, staff shifts and billing with a dunning ladder for failed cards.</p>
<p><a href="https://www.codenameone.com/blog/release-2026-11-06/pulse-desktop-owner.mp4">Download the owner video</a>.</p>
<h2>Try it in two commands</h2>
<p>The simulator has no watch or strap, so the dev backend plays demo heart rates into the live view. It runs in a dev profile with an in-memory database, text messages and pushes printed to the console and simulated card payments:</p>
<pre><code class="language-bash">CN1_PROFILE=dev backend/server.sh run
mvn verify -Psimulator -DskipTests -Dcodename1.platform=javase
</code></pre>
<p>Log in with the demo accounts from the guide (<code>owner@pulse.example</code>, <code>trainer@pulse.example</code>, <code>desk@pulse.example</code>) to see each role.</p>
<p>The <a href="https://www.codenameone.com/developer-guide/pulse-users-guide/">user's guide</a> walks through every screen, and the <a href="https://www.codenameone.com/developer-guide/pulse-implementors-guide/">implementor's guide</a> explains billing, the door pass, health and what to change to make it your studio's app.</p>
<p>Tomorrow: <a href="https://www.codenameone.com/blog/real-time-java-control-loops/">Real-Time Java: Control Loops the Garbage Collector Never Stops</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Dash: An Endless Runner That Races Through Your City]]></title><description><![CDATA[Dash is a full-stack endless runner template in Java: levels that turn from 2D into 3D mid-run, runs built from real streets on a map, cheat-proof…]]></description><link>https://debugagent.com/dash-an-endless-runner-that-races-through-your-city</link><guid isPermaLink="true">https://debugagent.com/dash-an-endless-runner-that-races-through-your-city</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Sat, 14 Nov 2026 01:01:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/e5c11707-3482-4c07-84d1-998cf5428edd.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a href="https://www.codenameone.com/blog/build-a-multiplayer-strategy-game-in-java/">Skirmish</a> showed that most of a mobile game is app: the sign-in, the menus, the shop, the friends list, the pushes and the server. Dash is the second game template, and it is a different kind of game: an endless runner. A runner dashes down a track of lanes, jumps hurdles, slides under barriers and changes lanes around traffic. You can generate it from the <a href="https://www.codenameone.com/initializr/">Initializr</a> today, under your own name and package, and the source is MIT-0.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p><a href="https://www.codenameone.com/blog/release-2026-11-06/dash-promo-tour.mp4">Download the Dash tour</a>.</p>
<h2>A level that turns into 3D</h2>
<p>The trick I like most in Dash is that a level can start as a side-scroller and become a 3D runner halfway through. The first stretch of <em>Neon Causeway</em> looks like a flat platformer: one row of hurdles and barriers, seen from the side. At 300 meters the camera swings behind the runner, the lanes open up, and the rest is a chase-camera runner.</p>
<p>There is no second game behind that. The simulation always has lanes, heights and distances, and a hurdle is cleared the same way from either angle. A level only carries <em>camera cues</em>, and the renderer blends between the two framings when the runner reaches one. Because the rules never see the camera, a level can change its view anywhere without changing who wins.</p>
<h2>Run your own street</h2>
<p>This is my favorite part to demo. Tap <em>Run your city</em>, pick a start and a finish on a real street map, and the route becomes a level. Every street is a stretch of track, every turn is a corner on the side it turns to, and the next street's name is called out before you reach it. Landmarks along the way, a station or a museum, show up as boards beside the track.</p>
<img src="https://www.codenameone.com/developer-guide/img/dash-city-route.png" alt="A route picked on the street map, with the landmarks along it pinned" width="1125" height="2436" />

<p>Pick two points.</p>
<img src="https://www.codenameone.com/developer-guide/img/dash-city-run.png" alt="The run down Cannon Street, with the street name under the score and the route map" width="1125" height="2436" />

<p>Run the streets.</p>
<img src="https://www.codenameone.com/developer-guide/img/dash-city-landmark.png" alt="A landmark's board beside the track as the runner passes it" width="1125" height="2436" />

<p>Pass the landmarks.</p>
<p>The map is Codename One's <code>MapView</code>, which draws OpenStreetMap data itself on every platform, and the route comes from <code>Routing</code>. The app reduces the route to streets and turns and hands it to the rules:</p>
<pre><code class="language-java">CityRoute route = new CityRoute("Old Harbour")
        .leg(420, CityRoute.STRAIGHT, "Quay Street")
        .leg(310, CityRoute.LEFT, "Rope Walk");
LevelDef level = route.level();
</code></pre>
<p><code>level()</code> is deterministic, so the server doesn't need a map. It rebuilds the same level from the encoded route and checks your run against it. The level's id is a hash of the route, so every route gets its own leaderboard, and nobody can trim a hard route into an easy one and keep the same board.</p>
<h2>Leaderboards you can trust</h2>
<p>A run is never reported as a number. The app sends the seed and the input log, a few hundred bytes, and the server plays it through the same Java rules module the app runs. A typed-in score, or a log edited to dodge an obstacle the player hit, does not reproduce. The rules use no floating point and no clock, so the phone, the server and the replay viewer agree to the bit.</p>
<img src="https://mermaid.ink/img/c2VxdWVuY2VEaWFncmFtCiAgICBwYXJ0aWNpcGFudCBQIGFzIFBob25lCiAgICBwYXJ0aWNpcGFudCBTIGFzIFNlcnZlcgogICAgUC0-PlA6IFJ1biBvbiBzZWVkICsgcnVsZXMgbW9kdWxlCiAgICBQLT4-UzogU2VlZCArIGlucHV0IGxvZyAoYSBmZXcgaHVuZHJlZCBieXRlcykKICAgIFMtPj5TOiBSZXBsYXkgdGhlIGxvZyBvbiB0aGUgc2FtZSBydWxlcwogICAgYWx0IFJlcGxheSBtYXRjaGVzCiAgICAgICAgUy0-PlM6IFBvc3Qgc2NvcmUgdG8gYWxsLXRpbWUsIHdlZWtseSwgZnJpZW5kcyBhbmQgY3JldyBib2FyZHMKICAgICAgICBTLS0-PlA6IFB1c2ggdG8gdGhlIGZyaWVuZCB5b3UganVzdCBiZWF0CiAgICBlbHNlIEVkaXRlZCBsb2cgb3IgdHlwZWQtaW4gc2NvcmUKICAgICAgICBTLS0-PlA6IFJlamVjdGVkLCBpdCBkb2Vzbid0IHJlcHJvZHVjZQogICAgZW5k?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>Every level has all-time, weekly, daily, friends and crew boards. Beat a friend's best and they get a push that opens that level's board.</p>
<h2>Racing your friends</h2>
<p>Open a party, share the link, and everyone runs the same track at the same moment. The server runs the race in lockstep: each phone sends its inputs, the room broadcasts each tick's inputs to every seat, and its own copy of the race decides the places. A client whose state drifts from the server's is caught by a hash it sends every second.</p>
<p>While you race you can talk. Voice uses Codename One's WebRTC API, peer to peer between each pair of players, with the game's own socket carrying the signalling. The server never touches the audio.</p>
<p><a href="https://www.codenameone.com/blog/release-2026-11-06/dash-gameplay-clip.mp4">Download the gameplay clip</a>.</p>
<h2>Build your own levels</h2>
<p>The track editor is in the app, on every platform. A level is a strip you paint on: tap a lane to drop a hurdle or a coin, tap the top row for a barrier across every lane, and drop camera cues where the view should change. <em>Playtest</em> runs the draft on the real rules. Publishing requires the bot to finish the level, so nobody can publish one that cannot be beaten. Published packs can be rated, raced, remixed and moderated from the admin console.</p>
<h2>Get it</h2>
<p>Choose <strong>Dash</strong> in the <a href="https://www.codenameone.com/initializr/">Initializr</a>, or read the <a href="https://www.codenameone.com/developer-guide/dash-implementors-guide/">guide chapter</a> first. It walks through the rules, the camera, the referee, races, voice and the editor, and what to change to make the game yours.</p>
<p>If you've ever wanted to ship a game but stalled on everything around the game, this is the part I'd copy. Sign-in, friends, pushes, a shop, moderation and a server that replays every run are already done, so the week you spend is on the fun part.</p>
<p>Tomorrow: <a href="https://www.codenameone.com/blog/launch-your-own-gym-app/">Pulse: Heart Rate Zones From the Watch to the Trainer's Screen</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Embedded Java: 20x Smaller Than Chrome, Faster Than Rust, Royalty Free]]></title><description><![CDATA[Codename One now targets embedded Linux: a touch UI that needs a twentieth of a Chromium kiosk's memory and no GPU, and a headless backend that served more…]]></description><link>https://debugagent.com/embedded-java-20x-smaller-than-chrome-faster-than-rust-royalty-free</link><guid isPermaLink="true">https://debugagent.com/embedded-java-20x-smaller-than-chrome-faster-than-rust-royalty-free</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Fri, 13 Nov 2026 01:01:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/8c3bfd7f-c961-435a-a387-28da378b119d.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Embedded software has the hardest job description in our industry. It has to run for years without a reboot. It has to fit in whatever RAM and flash the bill of materials allowed, because every chip you add is paid for again on every unit you ship. It has to respond instantly on a CPU slower than a phone from five years ago. And now it also has to look like the phone app, talk to the phone app, and report to a cloud service, because that's what customers expect from anything with a power cord.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>Most teams solve that with three or four stacks. C or C++ on the device for size and control, a browser or Qt for the screen, Swift and Kotlin for the companion app, something else on the server. Every boundary between them is a protocol written twice and a bug waiting to happen.</p>
<p>Codename One now runs on embedded Linux, and it covers every one of those pieces with one Java or Kotlin codebase. On our benchmark, the UI drew an animated gauge in <strong>18 MB of memory with no GPU</strong>, about a twentieth of what a Chromium kiosk needed to draw the same thing. The headless backend served <strong>379,900 requests per second on two cores, 1.3 times Rust's</strong> <code>axum</code>. And we don't charge royalties.</p>
<h2>Coming This Week</h2>
<p>Today is the embedded story. Then one post a day:</p>
<ul>
<li><strong>Saturday, November 7:</strong> <a href="https://www.codenameone.com/blog/build-an-endless-runner-in-java/">Dash: An Endless Runner That Races Through Your City</a>. A game template that turns from 2D into 3D mid-run, builds levels from real streets, and lets friends race with voice chat.</li>
<li><strong>Sunday, November 8:</strong> <a href="https://www.codenameone.com/blog/launch-your-own-gym-app/">Pulse: Heart Rate Zones From the Watch to the Trainer's Screen</a>. A gym and studio template built around HealthKit, Health Connect and Bluetooth heart rate straps.</li>
<li><strong>Monday, November 9:</strong> <a href="https://www.codenameone.com/blog/real-time-java-control-loops/">Real-Time Java: Control Loops the Garbage Collector Never Stops</a>. What real time means, why it's hard for a managed language, and how we do it.</li>
<li><strong>Tuesday, November 10:</strong> <a href="https://www.codenameone.com/blog/codename-one-on-xbox/">Packaging Java Apps for Xbox Developer Mode, and Why Consoles Need Help</a>. One build hint today. Shipping to consoles needs help we can't get alone.</li>
<li><strong>Wednesday, November 11:</strong> <a href="https://www.codenameone.com/blog/cn1libs-with-a-server-side/">Port Your Spring Code With Fewer Edits, and Libraries That Bring Their Own Server</a>. Logging, typed JSON, CORS, content negotiation and more of the JDK in the backend, plus cn1libs with a server half.</li>
<li><strong>Thursday, November 12:</strong> <a href="https://www.codenameone.com/blog/debug-dart-in-a-java-debugger/">Debug Your Dart in a Java Debugger, and JFX Central on a Phone</a>. Dart call stacks, Flutter fixes from a real port, a faster web port and a real JavaFX app on an iPhone.</li>
</ul>
<p><a href="https://www.codenameone.com/blog/build-an-endless-runner-in-java/"><img src="https://www.codenameone.com/blog/release-2026-11-06/dash-promo-tour-poster.jpg" alt="Dash running in 3D on a neon track" width="420" height="908" /></a></p>
<p>Dash, mid-run in 3D.</p>
<p><a href="https://www.codenameone.com/blog/launch-your-own-gym-app/"><img src="https://www.codenameone.com/blog/release-2026-11-06/pulse-phone-trainer-poster.jpg" alt="Pulse showing live heart rate zones for a class" width="420" height="746" /></a></p>
<p>Pulse's live class view.</p>
<p><a href="https://www.codenameone.com/blog/debug-dart-in-a-java-debugger/"><img src="https://www.codenameone.com/blog/release-2026-11-06/JFXCentral-demo-poster.jpg" alt="JFX Central running on an iPhone" width="420" height="913" /></a></p>
<p>JFX Central on an iPhone.</p>
<h2>Two flavors, two kinds of product</h2>
<p>The port comes in two flavors. The easiest way to explain them is with two products.</p>
<h3>A point of sale terminal: the UI flavor</h3>
<p>A POS terminal lives or dies on price. It needs a responsive touch screen, a receipt printer on a serial port, a card reader, and it has to sync with the store's back office. The merchant buys a hundred of them, so ten dollars of hardware is a thousand dollars on the order and the difference between winning and losing the deal.</p>
<p>A GPU is one of the first things you'd like to cut. Android won't let you: AOSP needs a board support package with a GPU driver. Flutter can limp along without one, if Mesa emulates OpenGL on the CPU, and on our gauge that took 1.4 CPU cores and 112 MB. A Chromium kiosk runs in 400 MB of RAM. Codename One draws in software by default, through DRM/KMS or the Linux frame buffer, with no X11 or Wayland. It needs nothing from the board but a frame buffer, so the cheapest SoC that drives your screen is enough.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBzdWJncmFwaCBUW1BPUyB0ZXJtaW5hbCwgbm8gR1BVXQogICAgICAgIFVbQ29kZW5hbWUgT25lIFVJPGJyLz5zb2Z0d2FyZSByZW5kZXJlcl0gLS0-IEZbRnJhbWUgYnVmZmVyXQogICAgICAgIFUgLS0-IFBbUmVjZWlwdCBwcmludGVyPGJyLz5zZXJpYWwgcG9ydF0KICAgICAgICBVIC0tPiBSW0NhcmQgcmVhZGVyPGJyLz5ORkMgLyBVU0JdCiAgICBlbmQKICAgIFUgLS0-fHNoYXJlZCBEVE9zLCBSRVNUfCBDW0JhY2sgb2ZmaWNlIGJhY2tlbmRdCiAgICBNW01hbmFnZXIncyBwaG9uZSBhcHBdIC0tPnxzYW1lIERUT3N8IEM=?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>When the board does have a GPU, set one build hint (or let the board profile choose it) and the same renderer composites through GBM, EGL and GLES 2. The frames are identical to the software output; the CPU time per frame drops. If the GPU driver turns out to be broken, the app logs why and falls back to software instead of showing a black screen.</p>
<p>The screen code is the code you'd write for a phone. Your POS app, the manager's phone app and the back office share the same entity classes, so a change to the receipt format breaks the build rather than a store.</p>
<h3>A robot vacuum: the headless flavor</h3>
<p>A robot vacuum needs a brain but no screen. The UI is the phone app. The device has to read its sensors, drive its motors, expose an API the app can find on the local network, accept only the owner's phone, take updates and keep working when the Wi-Fi drops. Every component inside it is multiplied by every unit sold, so memory and CPU headroom cost real money for the life of the product.</p>
<p>That's the backend flavor: the same Codename One backend that runs your cloud server, compiled to a native executable for the board. REST endpoints, WebSockets, the ORM, MQTT, Bonjour discovery and mutual TLS for device identity are all there, next to the hardware API.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBzdWJncmFwaCBWW1JvYm90IHZhY3V1bSwgaGVhZGxlc3NdCiAgICAgICAgQltDb2RlbmFtZSBPbmUgYmFja2VuZDxici8-bmF0aXZlIGV4ZWN1dGFibGVdIC0tPiBIW01vdG9ycywgYnVtcCBzZW5zb3JzLCBiYXR0ZXJ5PGJyLz5HUElPLCBJMkMsIFBXTV0KICAgICAgICBCIC0tPiBMW1JlYWwtdGltZSBtb3RvciBsb29wXQogICAgZW5kCiAgICBBW1Bob25lIGFwcF0gLS0-fEJvbmpvdXIsIHRoZW4gUkVTVCArIFdlYlNvY2tldDxici8-bXV0dWFsIFRMU3wgQgogICAgQiAtLT58b3V0Ym94IHdoZW4gb25saW5lfCBDW0Nsb3VkIGJhY2tlbmQ8YnIvPmZsZWV0LCB1cGRhdGVzXQogICAgQSAtLT58YXdheSBmcm9tIGhvbWV8IEM=?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>A controller on the vacuum is a Spring-style class that reads the hardware directly:</p>
<pre><code class="language-java">@RestController
@RequestMapping("/api/robot")
public class RobotController {
    private final I2cDevice fuelGauge;

    public RobotController() throws HardwareException {
        fuelGauge = Hardware.getInstance().openI2c(1, 0x36);
    }

    @GetMapping("/battery")
    public BatteryDto battery() throws HardwareException {
        return new BatteryDto(fuelGauge.readRegister(0x04));
    }
}
</code></pre>
<p>The phone app compiles against the same <code>BatteryDto</code>. It finds the vacuum with Bonjour when it's on the same network and goes through the cloud backend when it isn't, and the API is the same either way.</p>
<h2>Competitors that need a GPU, gigabytes and a prayer</h2>
<p>We ran the same workload in five toolkits: an 800 by 480 gauge with a sweeping arc, a needle and a bold percentage, redrawn every frame and capped at 60 frames per second, in software. Same Debian arm64 container, three runs each, median shown.</p>
<img src="https://www.codenameone.com/developer-guide/img/embedded-gui-memory.png" alt="Memory while animating, PSS in MB: Codename One: 18, Slint 23, Qt 23, JavaFX 116, Chromium 398, flutter-pi 112" width="720" height="322" />

<img src="https://www.codenameone.com/developer-guide/img/embedded-gui-first-frame.png" alt="Milliseconds to the first frame from a cold start: Codename One: 46, Slint 45, Qt 73, JavaFX 327, Chromium 717, flutter-pi 767" width="720" height="322" />

<table>
<thead>
<tr>
<th>Toolkit</th>
<th align="right">First frame, cold</th>
<th align="right">Frames per second</th>
<th align="right">Memory (PSS)</th>
<th align="right">On disk (files mapped)</th>
</tr>
</thead>
<tbody><tr>
<td>Codename One</td>
<td align="right">46 ms</td>
<td align="right">57</td>
<td align="right">18 MB</td>
<td align="right">15 MB</td>
</tr>
<tr>
<td>Slint 1.8</td>
<td align="right">45 ms</td>
<td align="right">51</td>
<td align="right">23 MB</td>
<td align="right">4.3 MB</td>
</tr>
<tr>
<td>Qt 6.4 Widgets</td>
<td align="right">73 ms</td>
<td align="right">62</td>
<td align="right">23 MB</td>
<td align="right">73 MB</td>
</tr>
<tr>
<td>JavaFX 26</td>
<td align="right">327 ms</td>
<td align="right">62</td>
<td align="right">116 MB</td>
<td align="right">102 MB</td>
</tr>
<tr>
<td>Chromium kiosk</td>
<td align="right">717 ms</td>
<td align="right">60</td>
<td align="right">398 MB</td>
<td align="right">378 MB</td>
</tr>
<tr>
<td>flutter-pi, GPU emulated on the CPU</td>
<td align="right">767 ms</td>
<td align="right">59</td>
<td align="right">112 MB</td>
<td align="right">233 MB</td>
</tr>
<tr>
<td>Android (AOSP)</td>
<td align="right">needs a GPU and a BSP</td>
<td align="right"></td>
<td align="right"></td>
<td align="right"></td>
</tr>
</tbody></table>
<p>Read that table as a hardware budget. The kiosk browser, the stack most teams reach for when they want "modern UX", needs 22 times our memory and 25 times our disk to draw one gauge, and takes three quarters of a second to show it. JavaFX, the other way to put Java on a board, needs six times our memory. Flutter does run without a GPU, but only by emulating one: it held its frame rate on 1.4 CPU cores, where we used 6% of one, in six times our memory and fifteen times our disk. Android can't run without a GPU at all. We're the only Java option in the table that fits on the board you'd actually want to pay for.</p>
<p>The container ran on an Apple Silicon Mac, not a board, so a real board will be slower. Compare the rows against each other, not against your hardware. Slint needs less disk than we do, and Qt pushes a few more frames. Our form also draws more than the others: a title bar, a button, a slider and a label around the gauge. The flutter-pi row is a release build of the same gauge drawing to the kernel's virtual display, because flutter-pi needs a display device; the others drew to memory. LVGL isn't in the table either. It's a low-level C graphics library: its widgets are drawn objects you wire up by hand, with no component model, data binding, navigation, networking or storage around them. Comparing it with a full application toolkit wouldn't be a fair test of either.</p>
<p>The headless flavor ran its own benchmark: a small JSON service pinned to two cores.</p>
<img src="https://www.codenameone.com/developer-guide/img/embedded-server-throughput.png" alt="Peak JSON requests per second on two cores: Codename One: 379,930, Rust 290,204, Go 178,930, Node.js 63,488, Spring Boot 33,322, Python 6,684" width="720" height="322" />

<table>
<thead>
<tr>
<th>Runtime</th>
<th align="right">Start</th>
<th align="right">Idle memory</th>
<th align="right">Peak requests/s</th>
<th align="right">p99 at peak</th>
</tr>
</thead>
<tbody><tr>
<td>Codename One backend</td>
<td align="right">40 ms</td>
<td align="right">9.2 MB</td>
<td align="right">379,900</td>
<td align="right">0.22 ms</td>
</tr>
<tr>
<td>Rust, <code>axum</code></td>
<td align="right">35 ms</td>
<td align="right">1.6 MB</td>
<td align="right">290,200</td>
<td align="right">0.25 ms</td>
</tr>
<tr>
<td>Go, <code>net/http</code></td>
<td align="right">48 ms</td>
<td align="right">5.2 MB</td>
<td align="right">178,900</td>
<td align="right">0.59 ms</td>
</tr>
<tr>
<td>Node.js</td>
<td align="right">147 ms</td>
<td align="right">48 MB</td>
<td align="right">63,500</td>
<td align="right">1.1 ms</td>
</tr>
<tr>
<td>Spring Boot 3.5</td>
<td align="right">1,340 ms</td>
<td align="right">164 MB</td>
<td align="right">33,300</td>
<td align="right">3.3 ms</td>
</tr>
<tr>
<td>Python, FastAPI</td>
<td align="right">270 ms</td>
<td align="right">42 MB</td>
<td align="right">6,700</td>
<td align="right">11 ms</td>
</tr>
</tbody></table>
<p>Rust and Go use less memory. But a Java backend that serves 1.3 times Rust's peak at a lower p99, and starts 33 times faster than Spring Boot in an eighteenth of its memory, changes what you can put in a vacuum. Like Rust, our server makes two system calls per request and allocates nothing but the object the handler returns. CI reruns this on arm64 with every change to the backend runtime and fails the build if we fall below Rust. The <a href="https://github.com/codenameone/CodenameOne/tree/master/scripts/embedded/bench">harness</a> is public, so check our Rust setup.</p>
<h2>The only stack that goes from the vacuum to the browser</h2>
<p>Here's what I think matters more than any single number. Look at what each option covers:</p>
<table>
<thead>
<tr>
<th></th>
<th align="center">Device UI</th>
<th align="center">Headless device</th>
<th align="center">Real-time loop</th>
<th align="center">iOS and Android</th>
<th align="center">Desktop</th>
<th align="center">Web</th>
<th align="center">Cloud backend</th>
</tr>
</thead>
<tbody><tr>
<td><strong>Codename One</strong></td>
<td align="center">yes</td>
<td align="center">yes</td>
<td align="center">yes</td>
<td align="center">yes</td>
<td align="center">yes</td>
<td align="center">yes</td>
<td align="center">yes</td>
</tr>
<tr>
<td>Qt</td>
<td align="center">yes</td>
<td align="center">Qt Core</td>
<td align="center">no</td>
<td align="center">yes</td>
<td align="center">yes</td>
<td align="center">WebAssembly</td>
<td align="center">HTTP server module</td>
</tr>
<tr>
<td>Slint</td>
<td align="center">yes</td>
<td align="center">no</td>
<td align="center">no</td>
<td align="center">Android, iOS preview</td>
<td align="center">yes</td>
<td align="center">WebAssembly</td>
<td align="center">no</td>
</tr>
<tr>
<td>Flutter (flutter-pi)</td>
<td align="center">GPU, or emulated on the CPU</td>
<td align="center">no</td>
<td align="center">no</td>
<td align="center">yes</td>
<td align="center">yes</td>
<td align="center">yes</td>
<td align="center">no</td>
</tr>
<tr>
<td>Chromium kiosk</td>
<td align="center">yes</td>
<td align="center">no</td>
<td align="center">no</td>
<td align="center">as a web app</td>
<td align="center">as a web app</td>
<td align="center">yes</td>
<td align="center">no</td>
</tr>
<tr>
<td>Android (AOSP)</td>
<td align="center">GPU only</td>
<td align="center">no</td>
<td align="center">no</td>
<td align="center">Android only</td>
<td align="center">no</td>
<td align="center">no</td>
<td align="center">no</td>
</tr>
</tbody></table>
<p>Nobody else gives you a device UI, a headless device, a real-time control loop, the phone app, the desktop app, the web app and the cloud server from one language, one build and one set of classes. That's the "super full stack": the entities, the DTOs and the API contract live in a <code>shared</code> module that every target compiles against. A field renamed on the vacuum is a compile error in the phone app, not a support ticket. One team can own the whole product, and one security fix lands everywhere at once.</p>
<p>The rest of the ecosystem comes along: Bluetooth LE, NFC, MQTT, Bonjour, the ORM, push, crash reporting and the build tools you already use for mobile.</p>
<h2>What it looks like in code</h2>
<p>Hardware access is in the core API. GPIO, I2C, SPI, serial, PWM, CAN, the watchdog and the backlight go through the kernel's own interfaces, with no extra library:</p>
<pre><code class="language-java">Hardware hw = Hardware.getInstance();
try {
    if (hw.isSupported(Hardware.FEATURE_GPIO)) {
        GpioPin led = hw.openGpioOutput("gpiochip0", 17, false);
        GpioPin button = hw.openGpioInput("gpiochip0", 27,
                GpioPin.BIAS_PULL_UP, GpioPin.EDGE_FALLING);
        button.setListener((pin, rising, nanos) -&gt; {
            try {
                led.setHigh(!led.isHigh());
            } catch (HardwareException e) {
                Log.e(e);
            }
        });
    }
    if (hw.isSupported(Hardware.FEATURE_I2C)) {
        I2cDevice sensor = hw.openI2c(1, 0x48);
        Log.p("Sensor reads " + sensor.readRegister(0));
    }
} catch (HardwareException e) {
    Log.e(e);
}
</code></pre>
<p>On a phone, <code>isSupported</code> answers false, so the same class is safe everywhere. In the simulator it runs against a virtual board with 32 GPIO lines, a TMP102 temperature sensor, an EEPROM and loopback SPI, serial, and CAN. You can write and unit test the hardware code before the board arrives.</p>
<p>Getting it onto the board is one command. It builds, copies the executable over SSH, installs it as a systemd service and follows the log:</p>
<pre><code class="language-bash">mvn cn1:runOnDevice -Dcn1.board=rpi5 -Dcn1.device.host=pi.local -Dcn1.device.user=pi
</code></pre>
<p>Board profiles cover the Raspberry Pi family, <a href="http://i.MX">i.MX</a> 8 and <a href="http://i.MX">i.MX</a> 6, RK3588, Jetson, BeaglePlay and generic arm64, armv7, x64 and RISC-V. There's a Yocto layer for production images, and a cross build can point at a Yocto or Buildroot SDK sysroot.</p>
<h2>No royalties, and the support embedded actually needs</h2>
<p>Embedded UI is usually sold per unit. You ship ten thousand terminals and pay a royalty on each one, which is fine until the product succeeds and the toolkit becomes a line item on every unit you ship.</p>
<p>Codename One doesn't charge royalties. It's open source under GPL 2 with the Classpath exception, on devices like everywhere else.</p>
<p>What embedded teams need from a vendor is different. A device ships once and stays in the field for ten years or more. It runs the exact framework version it was certified with, and the team needs a security fix in that version five years from now, not an upgrade to whatever master looks like then. That's long-term support: a maintained branch for your product, backports of the fixes that matter to you, and someone who answers when the board vendor's new kernel breaks something.</p>
<p>That runs far past the timeline we normally support, and it's work we're happy to do with you directly. It's a better deal for both sides than a royalty: you pay for the support you use, and the price doesn't grow with your success. If you're planning a product, <a href="https://www.codenameone.com/contact-us.html">talk to us</a> early so the branch matches your release.</p>
<h2>Linux today, other systems and RTOS on request</h2>
<p>We only support embedded Linux right now. If your product runs on Zephyr, QNX, VxWorks, FreeRTOS or a vendor OS, tell us. The renderer needs a frame buffer and the backend needs sockets, and ParparVM already emits portable C, so a new OS means porting two layers. Real demand decides which one comes next, and that includes a proper hard real-time RTOS.</p>
<h2>More This Week</h2>
<h3>Real-time threads</h3>
<p>A vacuum's motor loop, or a POS card reader's timing, has deadlines, and a garbage collector that stops the world is the usual reason people say Java can't meet them. Codename One now has real-time threads on PREEMPT_RT Linux that the collector never stops:</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBUW2N5Y2xlIGluIHlvdXIgUmVhbHRpbWVUYXNrXSAtLT4gQntCdWlsZH0KICAgIEIgLS0-fGFsbG9jYXRlc3wgWFtCdWlsZCBmYWlscywgbmFtZXMgdGhlIGxpbmVdCiAgICBCIC0tPnxjbGVhbnwgTltOYXRpdmUgY29kZSwgbm8gSklUXQogICAgTiAtLT4gUltTQ0hFRF9GSUZPIHRocmVhZCwgcGlubmVkIGNvcmUsIGxvY2tlZCBtZW1vcnldCiAgICBHW0dhcmJhZ2UgY29sbGVjdG9yXSAtLi0-fG5ldmVyIHN0b3BzIGl0fCBS?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<pre><code class="language-java">class MotorLoop extends RealtimeTask {
    private final double[] gains = new double[64];   // allocate up front
    private PwmChannel pwm;

    public void setup() {                            // may allocate
        try {
            pwm = Hardware.getInstance().openPwm(0, 0);
        } catch (HardwareException e) {
            Log.e(e);
        }
    }

    public void cycle() {                            // must not allocate
        // read sensors, compute gains, then pwm.setDutyCycle(...)
    }
}

Realtime.getInstance().start("motor",
        new RealtimeParameters().setPeriodNanos(1000000).setPriority(80).setCpu(3),
        new MotorLoop());
</code></pre>
<p>If <code>cycle()</code> allocates, the build fails and names the method and the line. Every thread keeps latency statistics so you can prove the deadline on your own board. Monday's <a href="https://www.codenameone.com/blog/real-time-java-control-loops/">real-time article</a> explains the terms, what makes this hard for a managed language and how we handle each part.</p>
<h3>Dash: race through your city</h3>
<p>Dash gameplay on a neon track.</p>
<p>Dash is our second game template: an endless runner whose levels can start as a 2D side-scroller and swing into 3D mid-run. Pick two points on a real street map and the route becomes a level, street names and landmarks included:</p>
<pre><code class="language-java">CityRoute route = new CityRoute("Old Harbour")
        .leg(420, CityRoute.STRAIGHT, "Quay Street")
        .leg(310, CityRoute.LEFT, "Rope Walk");
LevelDef level = route.level();
</code></pre>
<p>The server replays every run to keep the leaderboards clean, and friends race the same track with voice chat. Saturday's <a href="https://www.codenameone.com/blog/build-an-endless-runner-in-java/">Dash article</a> has the details.</p>
<h3>Pulse: heart rates from the wrist to the trainer</h3>
<p><a href="https://www.codenameone.com/blog/release-2026-11-06/pulse-phone-trainer.mp4">Download the trainer video</a>.</p>
<p>Pulse is a gym and studio template built around health data. A member's watch or Bluetooth chest strap feeds a workout session, the readings go to the studio's backend, and the trainer sees every member's heart rate zone live. Past workouts come in from HealthKit or Health Connect through one API. Sunday's <a href="https://www.codenameone.com/blog/launch-your-own-gym-app/">Pulse article</a> walks through the health code.</p>
<h3>Xbox, and help with consoles</h3>
<p><code>codename1.arg.windows.xbox=true</code> builds the native Windows port as a UWP app for Xbox Developer Mode:</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBHW1lvdXIgZ2FtZSBvciBhcHBdIC0tPiBQW05hdGl2ZSBXaW5kb3dzIHBvcnRdCiAgICBQIC0tPnx3aW5kb3dzLnhib3g9dHJ1ZXwgVVtVV1AgYXBwIGNvbnRhaW5lcjxici8-Q29yZVdpbmRvdywgbm8gZGVza3RvcCB3aW5kb3ddCiAgICBVIC0tPiBSW0RpcmVjdDJEIGludG8gYSBEaXJlY3QzRCBzd2FwIGNoYWluXQogICAgVSAtLT4gSVtDb250cm9sbGVyOiBELXBhZCBhbmQgc3RpY2sgdG8gZGlyZWN0aW9uczxici8-QSB0byBmaXJlLCBCIHRvIGJhY2tdCiAgICBVIC0tPiBTW1RWIG92ZXJzY2FuIGFzIHRoZSBkaXNwbGF5IHNhZmUgYXJlYV0=?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>Your game keeps reading <code>Display.getGameAction()</code> as it does on a phone. We haven't run it on a real Xbox yet, and Developer Mode can't sell a game. Shipping on consoles needs SDKs behind NDAs, so Tuesday's <a href="https://www.codenameone.com/blog/codename-one-on-xbox/">Xbox article</a> is also a request: if you can open that door, talk to us.</p>
<h3>Port your Spring code with fewer edits</h3>
<p>Porting real services to the Codename One backend keeps finding the small things a Spring developer expects. This round closed a batch of them, so code like this now moves over unchanged:</p>
<pre><code class="language-java">@RestController
@CrossOrigin(origins = "https://shop.example.com")
public class OrderController {
    private static final Logger LOG = Logger.getLogger(OrderController.class);

    @PostMapping(value = "/orders", consumes = "application/json", produces = "application/json")
    public Order place(@RequestBody Order order) {
        if (order.lines.isEmpty()) {
            throw new ResponseStatusException(400, "An order needs at least one line");
        }
        MDC.put("customer", order.customer);
        LOG.info("Placing order with {} lines", order.lines.size());
        return orders.save(order);
    }
}
</code></pre>
<p><code>Json.read(body, Order.class)</code> and <code>Json.write(order)</code> work through codecs generated at build time, <code>String.matches</code> and <code>java.util.regex</code> work, and <code>BigDecimal</code>, <code>YearMonth</code>, <code>Semaphore</code> and <code>ConcurrentLinkedQueue</code> are there. A cn1lib can now also ship its own controllers, entities, and migrations. Wednesday's <a href="https://www.codenameone.com/blog/cn1libs-with-a-server-side/">backend article</a> has the full list.</p>
<h3>Dart debugging, a faster web port and JFX Central</h3>
<p><a href="https://www.codenameone.com/blog/release-2026-11-06/JFXCentral-demo.mp4">Download the JFX Central video</a>.</p>
<p>That's <a href="https://www.jfx-central.com/">JFX Central</a>, a real JavaFX application written by JavaFX experts, running on an iPhone through our JavaFX layer. It isn't as polished as an app written for Codename One, but bindings, cells, CSS and remote images all work.</p>
<p>Flutter apps now debug in Dart: the build rewrites the class files' line tables and adds a JSR-45 source map, so stack traces name your <code>.dart</code> files and the standard Java debugger steps through Dart. The JavaScript port got faster too. It inlines getters and setters, fuses <code>StringBuilder</code> chains into plain string operations and keeps every array packed. String building in our compute suite went from 99 to 68 ms, and every checksum still matches the JVM. Integer division by zero now throws <code>ArithmeticException</code> in the browser, as Java says it should. Thursday's <a href="https://www.codenameone.com/blog/debug-dart-in-a-java-debugger/">article</a> covers all three.</p>
<h2>Try it</h2>
<p>The <a href="https://www.codenameone.com/developer-guide/embedded-linux/">embedded Linux chapter</a> covers displays, the GPU path, board profiles, deployment, hardware access, the five connected-product shapes and the full benchmark with its method. The harness is in <code>scripts/embedded/bench</code> in the <a href="https://github.com/codenameone/CodenameOne">repository</a> if you want to rerun it on your own board. I'd love to see those numbers.</p>
<p>If you're building a device, tell me what board it runs on and what you're using today. And if your product needs an OS we don't support yet, that's exactly the conversation I want to have.</p>
]]></content:encoded></item><item><title><![CDATA[Caches, Certificates, Streaming Uploads and a Simulator That Types]]></title><description><![CDATA[Eight backend upgrades driven by this month's templates: a bounded cache, outbound OAuth tokens, certificates and CSRs, JSON codecs, error advice…]]></description><link>https://debugagent.com/caches-certificates-streaming-uploads-and-a-simulator-that-types</link><guid isPermaLink="true">https://debugagent.com/caches-certificates-streaming-uploads-and-a-simulator-that-types</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Thu, 12 Nov 2026 01:01:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/d53f7ce3-6787-4c0a-999b-fc07e22ec372.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The templates this month (a bank, a streaming service, a messenger, a delivery service and a game) all have servers, and every server ran into something a modern web app takes for granted. This post collects what we added to the Codename One backend to fill those gaps. Several of them apply to the client too. Then there's the simulator, which can now show a virtual keyboard and record a video of your app.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>If you write Spring Boot during the day, most of this will look familiar on purpose. When there's no reason to differ, the backend behaves the way Spring does.</p>
<h2>A bounded cache</h2>
<p>Bastion looks up prices on every quote. Calling the price feed on every quote is slow and burns the feed's quota. Caching forever shows stale prices. The new <a href="https://www.codenameone.com/developer-guide/backend-observability/#_application_caches">cache</a> has a size bound, expiry, a removal listener and metrics:</p>
<pre><code class="language-java">private static final Cache&lt;String, Price&gt; PRICES = Cache.&lt;String, Price&gt;builder("prices")
        .maximumSize(10000)
        .expireAfterWriteMillis(60000)
        .removalListener((sku, price, cause) -&gt; {
            if (cause == Cache.SIZE) {
                System.out.println("evicted " + sku);
            }
        })
        .build();
</code></pre>
<h2>Tokens for calling other services</h2>
<p>Your server calls other servers: a Google API with a service account, a billing service with client credentials. <a href="https://www.codenameone.com/developer-guide/backend-security/#backend-security-outbound"><code>AccessTokenProvider</code></a> fetches the token, caches it and refreshes it before it expires:</p>
<pre><code class="language-java">AccessTokenProvider billing(Config config) throws IOException {
    return new AccessTokenProvider(ClientCredentialsGrant
            .builder("https://auth.example.com/oauth/token", "orders-service")
            .clientSecret(config.get("billing.client-secret"))
            .scopes("invoices:write")
            .build());
}
</code></pre>
<p>The same change added <a href="https://www.codenameone.com/developer-guide/backend-security/#backend-security-migration">importing users from an existing identity store</a>, so moving an app's accounts over doesn't mean asking everyone to reset a password.</p>
<h2>Certificates without OpenSSL on the command line</h2>
<p>Banks and partners love mutual TLS and private certificate authorities. The <a href="https://www.codenameone.com/developer-guide/backend-security/#backend-security-pki">PKI API</a> parses PEM, validates a chain against your own anchors, creates certificate signing requests and reads and writes PKCS#12:</p>
<pre><code class="language-java">List&lt;Certificate&gt; anchors = Certificate.listFromPem(KeyFiles.read("/etc/app/partner-ca.pem"));
List&lt;Certificate&gt; path = new CertificateValidator(anchors)
        .forHost("api.partner.example")
        .validate(Certificate.listFromPem(presentedPem));
</code></pre>
<h2>Errors in one place</h2>
<p><a href="https://www.codenameone.com/developer-guide/backend-web/#backend-web-errors"><code>@RestControllerAdvice</code> and <code>@ExceptionHandler</code></a> turn exceptions into responses once, instead of a try and catch in every handler. <a href="https://www.codenameone.com/developer-guide/backend-web/#backend-web-interceptors">Interceptors</a> and <a href="https://www.codenameone.com/developer-guide/backend-web/#backend-web-validation">validation</a> came with the same change.</p>
<pre><code class="language-java">@RestControllerAdvice
public class ApiErrors {
    @ExceptionHandler(IllegalArgumentException.class)
    public HttpServer.Response badInput(IllegalArgumentException e, HttpServer.Request request) {
        return HttpServer.Response.text(400, e.getMessage()).header("X-Error", "input");
    }
}
</code></pre>
<h2>Streaming bodies and a proxy</h2>
<p>Reel's uploads are video files. Reading them into memory isn't an option. <a href="https://www.codenameone.com/developer-guide/backend-web/#_large_uploads_and_downloads"><code>request.getBodyStream()</code></a> hands you the body as it arrives, and large uploads, multipart ones included, spool to disk instead of the heap:</p>
<pre><code class="language-java">@PostMapping("/archive")
public Map&lt;String, Long&gt; archive(HttpServer.Request request) throws IOException {
    long total = 0;
    byte[] buffer = new byte[64 * 1024];
    InputStream in = request.getBodyStream();
    try {
        for (int n = in.read(buffer); n &gt; 0; n = in.read(buffer)) {
            total += n;                 // store, hash or forward each block
        }
    } finally {
        in.close();
    }
    return Collections.singletonMap("bytes", total);
}
</code></pre>
<p><a href="https://www.codenameone.com/developer-guide/backend-web/#_forwarding_to_another_service"><code>HttpProxy</code></a> forwards a request to an internal service. It reaches only its target and the hosts you allow, so a crafted path can't turn your server into an open proxy:</p>
<pre><code class="language-java">images = new HttpProxy("https://images.internal:8443")
        .allowHost("cdn.internal");

@RequestMapping("/images/{name}")
public HttpServer.Response image(HttpServer.Request request) {
    return images.forward(request);  // the same path and query, upstream
}
</code></pre>
<h2>JSON codecs and java.time in the ORM</h2>
<p>These two apply to the client as well as the server. <a href="https://www.codenameone.com/developer-guide/backend-web/#backend-json-contract">JSON mapping</a> gained custom codecs through <code>JsonTypeAdapter</code>, constructor based creators, generics, arrays and explicit null handling. A codec turns a type into JSON and back, here a money amount kept as a decimal string so it never passes through a <code>double</code>:</p>
<pre><code class="language-java">public final class MoneyAdapter implements JsonTypeAdapter&lt;Money&gt; {
    public Object toJson(Money m) {
        return m == null ? null : m.toDecimalString();
    }
    public Money fromJson(Object json) {
        if (json == null) {
            return null;
        }
        if (!(json instanceof String)) {
            throw new IllegalArgumentException("expected an amount");
        }
        return Money.parse((String) json);
    }
}
</code></pre>
<p>Put <code>@JsonAdapter(MoneyAdapter.class)</code> on the field or the class and the mapper uses it.</p>
<p>The <a href="https://www.codenameone.com/developer-guide/annotation-sqlite-orm/#orm-native-dates">ORM now maps <code>java.time</code></a> without an annotation: <code>Instant</code> and <code>LocalDateTime</code> as epoch milliseconds and <code>LocalDate</code> as an epoch day, so a date column is a number you can index and compare:</p>
<pre><code class="language-java">@Entity
public class Booking {
    @Id
    private long id;
    private Instant created;        // epoch milliseconds
    private LocalDate checkIn;      // epoch day
    private LocalDateTime pickup;   // epoch milliseconds
}
</code></pre>
<h2>Tests that start only what they need</h2>
<p><a href="https://www.codenameone.com/developer-guide/backend-testing/#_testing_one_slice_of_the_application"><code>@WebMvcTest</code></a> starts one controller and the beans you list, not the whole application, and <code>MockMvc</code> calls it without a socket:</p>
<pre><code class="language-java">@WebMvcTest(value = GreetingApi.class, includes = Greetings.class)
class GreetingSliceTest {
    @Autowired
    private MockMvc mvc;

    @Test
    void greetsWithOnlyTheControllerWired() throws Exception {
        mvc.perform(get("/greet/{name}", "Ada"))
                .andExpect(status().isOk())
                .andExpect(jsonPath("$.greeting").value("Hello, Ada"));
    }
}
</code></pre>
<p>The same change defined a <a href="https://www.codenameone.com/developer-guide/backend-observability/#_the_metric_schema">metric schema</a> and <a href="https://www.codenameone.com/developer-guide/backend-observability/#_probes_and_draining">probes</a> for observability, so a dashboard means the same thing for every Codename One service.</p>
<p>The backend is still a tech preview. The <a href="https://www.codenameone.com/developer-guide/backend/">backend chapters</a> of the developer guide cover each of these, with the code that the snippets above come from.</p>
<h2>A simulator that types</h2>
<p>Here's a bug you've probably shipped. The login form looks great in the simulator. On a phone, the keyboard slides up and covers the password field, or the layout jumps, and nobody noticed because the simulator never had a keyboard.</p>
<p>Now it <a href="https://www.codenameone.com/developer-guide/mcp-headless-api/#_simulator_keyboard_touches_and_recording">does</a>. <strong>Simulate &gt; Virtual Keyboard</strong> slides up a keyboard styled after the skin's platform, and it behaves the way that platform does:</p>
<ul>
<li><strong>iOS:</strong> the screen keeps its size, <code>Display.getInvisibleAreaUnderVKB()</code> reports the keyboard height, and the focused field scrolls into view.</li>
<li><strong>Android, resize mode:</strong> the form gets a <code>sizeChanged</code> and lays out again.</li>
<li><strong>Android, pan mode:</strong> the whole screen shifts up.</li>
</ul>
<figure>The simulated iOS keyboard sliding up over a sign up form.<figcaption>Recorded by the simulator itself, driven over MCP by the script below.</figcaption></figure>

<p>By default Android picks a mode per field, the way the real platform does. The <strong>Android: Resize</strong> and <strong>Android: Pan</strong> menu items, or the <code>androidSoftInput</code> setting, force one so you can test both.</p>
<p>The simulator also records. It writes MP4, MOV, WebM or an animated GIF, of the screen alone or inside the device skin, on a fixed frame clock so the video doesn't stutter when your machine is busy. Taps show touch indicators and can play a click, and you can add captions. That's a store preview, a bug report or a tweet, without a screen recorder.</p>
<p>Both are also tools in the simulator's built in MCP server, so a coding agent can drive a whole flow and hand you the video:</p>
<pre><code class="language-plaintext">sim_keyboard_set   {"mode": "ios"}
sim_record_start   {"path": "/tmp/signup.mp4", "frame": "screen"}
sim_record_caption {"text": "The keyboard slides up, the field stays visible"}
ui_snapshot        {}
sim_tap            {"nodeId": 41}
sim_keyboard_type  {"text": "ada@example.com"}
sim_keyboard_key   {"key": "next"}
sim_keyboard_type  {"text": "correct horse"}
sim_keyboard_key   {"key": "done"}
sim_record_stop
</code></pre>
<p>It's an emulation of each platform's keyboard behavior, not the native keyboard itself, so do a final pass on a device. But the covered password field shows up on your desk now, not in a one-star review. The <a href="https://www.codenameone.com/developer-guide/mcp-headless-api/#_simulator_keyboard_touches_and_recording">simulator keyboard and recording section</a> of the MCP chapter lists every tool.</p>
<h2>That's the week</h2>
<p>Flutter, Compose, Swing, JavaFX and Android code, a bank, a streaming service, phones without Google and a better backend. Next week, we keep going. The <a href="https://www.codenameone.com/blog/flutter-better-in-java/">Flutter post</a> links everything from this week in one place.</p>
]]></content:encoded></item><item><title><![CDATA[GrapheneOS, LineageOS, /e/OS and Others Are Now Officially Supported]]></title><description><![CDATA[Codename One now officially supports GrapheneOS, LineageOS, CalyxOS, /e/OS and other Android builds without Google, with a boundary CI verifies and push…]]></description><link>https://debugagent.com/grapheneos-lineageos-e-os-and-others-are-now-officially-supported</link><guid isPermaLink="true">https://debugagent.com/grapheneos-lineageos-e-os-and-others-are-now-officially-supported</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Wed, 11 Nov 2026 01:01:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/cae84f4c-80da-4b67-aab0-d5469cc09291.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This post is mostly about phones that don't have Google at all: GrapheneOS, LineageOS, CalyxOS, /e/OS and other Android builds. Codename One now supports them officially. After that, a shorter update on the Android compatibility layer, which runs existing Android apps on iPhone, desktop and the web.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<h2>GrapheneOS, LineageOS, CalyxOS and /e/OS</h2>
<p>I was a member of Team OS/2. I know what it's like to use an operating system the big vendors forgot, and to find that half the apps you need just don't start. People choose GrapheneOS, LineageOS and other AOSP builds for good reasons, usually privacy, and they deserve apps that work. There's a business case too: when you support a niche operating system its users have learned to live without, you get the most loyal advocates your product will ever have. They notice, they remember, and they tell each other.</p>
<p>Codename One apps mostly worked on these phones before. But mostly isn't support: call the wrong API and you could hit a failure, or behavior nobody could predict. Now it's official, with a clear boundary. One APK serves both kinds of phone: at run time it checks whether Google Play Services is there. No build hint, no flavor, no second build. The Android port never calls Play services, Play Core or Firebase without checking first, and CI enforces that, so a future change can't quietly break it.</p>
<table>
<thead>
<tr>
<th>Feature</th>
<th>With Google Play</th>
<th>Without Google Play</th>
</tr>
</thead>
<tbody><tr>
<td>UI, storage, networking, SQLite, media</td>
<td>Works</td>
<td>Works</td>
</tr>
<tr>
<td>On device ML Kit models</td>
<td>Works</td>
<td>Works</td>
</tr>
<tr>
<td>Location and geofences</td>
<td>Fused location</td>
<td>Framework <code>LocationManager</code></td>
</tr>
<tr>
<td>Maps</td>
<td>Google Maps</td>
<td>Vector <code>MapView</code></td>
</tr>
<tr>
<td>Google sign in</td>
<td>Native</td>
<td>Browser OAuth flow</td>
</tr>
<tr>
<td>Push</td>
<td>Firebase</td>
<td>UnifiedPush (ntfy, NextPush, Sunup)</td>
</tr>
<tr>
<td>In-app purchase</td>
<td>Play Billing</td>
<td>Not available</td>
</tr>
<tr>
<td>Integrity attestation, in-app review</td>
<td>Works</td>
<td>Not available</td>
</tr>
</tbody></table>
<p>The location fallback fixed something on Google phones too: builds without Play location now get proximity alerts and background location through the framework API.</p>
<h3>Push, with one line</h3>
<p>Push needs one line of configuration, because the phone has no Firebase to deliver it. UnifiedPush lets the user pick the app that holds the push connection, called a distributor. A UnifiedPush endpoint is a standard Web Push subscription, so the Codename One push service delivers to it with the Web Push credential your app already has. You copy its public key into a build hint:</p>
<pre><code class="language-properties">codename1.arg.android.unifiedPush.vapidKey=&lt;your 87 character VAPID public key&gt;
</code></pre>
<p>Your app code doesn't change, and neither does your server. The registration order is automatic:</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IFRECiAgICBTW1B1c2hDbGllbnQgcmVnaXN0ZXJzXSAtLT4gR3tHb29nbGUgUGxheSBTZXJ2aWNlcz99CiAgICBHIC0tPnx5ZXN8IEZbRmlyZWJhc2UgQ2xvdWQgTWVzc2FnaW5nXQogICAgRyAtLT58bm98IEh7SHVhd2VpIEhNUz99CiAgICBIIC0tPnx5ZXN8IEtbSHVhd2VpIFB1c2ggS2l0XQogICAgSCAtLT58bm98IFV7VW5pZmllZFB1c2ggZGlzdHJpYnV0b3IgaW5zdGFsbGVkP30KICAgIFUgLS0-fHllc3wgUFtVbmlmaWVkUHVzaCwgZGVsaXZlcmVkIGFzIFdlYiBQdXNoXQogICAgVSAtLT58bm98IEVbcHVzaFJlZ2lzdHJhdGlvbkVycm9yOiBhIHB1c2ggc2VydmljZSBpcyBuZWVkZWRd?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>The one real gap is in-app purchase. Play Billing needs the Play Store. If selling on de-Googled phones matters to you, tell us; it's something we can add.</p>
<p>To test, use the Android emulator's AOSP system images, the <code>default</code> target, which have no Google apps. The <a href="https://www.codenameone.com/developer-guide/android-without-google-play/">Android without Google Play chapter</a> has the details.</p>
<h2>Also new: classic Android apps, on iPhone</h2>
<p><a href="https://www.codenameone.com/blog/android-apps-beyond-android/">Three weeks ago</a> we showed that an Android Studio module's <code>src/main</code> can build unmodified as a Codename One app. There's no Android runtime inside it. Views are Codename One components, layouts follow Android's measure and layout rules, and resources compile to a binary table at build time. Nothing parses XML or uses reflection on the device. You import a project with one command:</p>
<pre><code class="language-bash">mvn cn1:import-android-project -Dcn1.android.import=/path/to/MyAndroidApp
mvn cn1:build -Dcodename1.platform=ios
</code></pre>
<p><a href="https://www.codenameone.com/developer-guide/img/android-interop-material.png"><img src="https://www.codenameone.com/developer-guide/img/android-interop-material.png" alt="A Material 3 screen on Android and on Codename One" width="736" height="800" /></a></p>
<p>Material 3.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/android-interop-recycler.png"><img src="https://www.codenameone.com/developer-guide/img/android-interop-recycler.png" alt="A RecyclerView on Android and on Codename One" width="736" height="800" /></a></p>
<p>RecyclerView.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/android-interop-kotlin.png"><img src="https://www.codenameone.com/developer-guide/img/android-interop-kotlin.png" alt="A Kotlin activity on Android and on Codename One" width="736" height="800" /></a></p>
<p>Kotlin activities.</p>
<p>Each pair shows Android on the left and Codename One on the right, from the same source.</p>
<h3>What's new: the parts real apps lean on</h3>
<p>Toy apps are mostly UI. Real apps store data, run work in the background and talk to the hardware. The layer now covers those:</p>
<ul>
<li><strong>Room.</strong> The build generates the <code>_Impl</code> classes, the way Android's annotation processor does. Features we don't support yet (<code>@Relation</code>, <code>suspend</code> DAOs, Flow, Rx, Paging, <code>@AutoMigration</code> and FTS) fail the build and name the member.</li>
<li><strong>WorkManager.</strong> Chains, unique work, retries and LiveData status, persisted across app restarts.</li>
<li><strong>Location and sensors.</strong> <code>LocationManager</code> and <code>SensorManager</code>.</li>
<li><strong>Services.</strong> Manifest services, including <code>startForeground()</code> mapped to Codename One's <code>ForegroundService</code>. Notifications from <code>NotificationManager</code> and <code>NotificationCompat</code> show as local notifications.</li>
<li><strong>Keystore.</strong> AES keys from <code>AndroidKeyStore</code> with GCM and CBC.</li>
<li><strong>Document pickers.</strong> <code>ACTION_OPEN_DOCUMENT</code>, <code>ACTION_CREATE_DOCUMENT</code> and <code>ACTION_GET_CONTENT</code>, plus the ActivityResult contracts, open the platform's native open and save dialogs.</li>
</ul>
<p>So this is ordinary Android code, and it now runs on an iPhone:</p>
<pre><code class="language-java">@Dao
public interface NoteDao {
    @Query("SELECT * FROM Note ORDER BY created DESC")
    List&lt;Note&gt; all();

    @Insert
    long insert(Note note);
}

Intent save = new Intent(Intent.ACTION_CREATE_DOCUMENT);
save.addCategory(Intent.CATEGORY_OPENABLE);
save.setType("text/plain");
save.putExtra(Intent.EXTRA_TITLE, "notes.txt");
startActivityForResult(save, SAVE_NOTES);
</code></pre>
<h3>Where iOS says no</h3>
<p>Some Android behavior has no iOS equivalent, and the <a href="https://www.codenameone.com/developer-guide/android-interop/">Android chapter</a> has a table for it. Location in a foreground service keeps running in the background when the manifest asks for background location. Other foreground service work gets only the short window iOS allows. Constrained WorkManager jobs go to iOS's background task scheduler, and iOS decides when they run. On iOS, <code>ACTION_CREATE_DOCUMENT</code> returns <code>RESULT_OK</code> right away and shows the save dialog when your app closes the output stream, so a cancel isn't reported back.</p>
<p>Other limits: Keystore keys aren't hardware backed there, <code>Parcel</code> is an in process container, SQLite uses a single connection, there are no system content providers or broadcasts, and reflection based libraries won't run on iOS.</p>
<p>Tomorrow, the last post of the week: <a href="https://www.codenameone.com/blog/backend-caches-certificates-and-a-simulator-that-types/">Caches, Certificates, Streaming Uploads and a Simulator That Types</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Reel: Your Own Streaming Service or Course Platform]]></title><description><![CDATA[Reel is a streaming service and its server in one Java project. Flip a preset and it's a subscription service, a creator platform with community uploads…]]></description><link>https://debugagent.com/reel-your-own-streaming-service-or-course-platform</link><guid isPermaLink="true">https://debugagent.com/reel-your-own-streaming-service-or-course-platform</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Tue, 10 Nov 2026 01:01:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/98fb6ab0-0a8e-48e9-ad8e-6e1eb291fbb4.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Video is how a lot of businesses now talk to their customers. A gym sells classes, a university publishes lectures, a creator community wants its own home instead of renting space on someone else's platform. They all need the same pieces: a catalog, a player that remembers where you stopped, uploads, moderation, payments and some protection for paid content.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p><strong>Reel</strong> is those pieces, the app and its server in one Java project. Like last week's <a href="https://www.codenameone.com/blog/rewrite-everything-in-java-not-rust/">Skirmish, Parley and Savor</a>, it's a template you generate and brand, not a demo you admire.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/reel-viewer-home.png"><img src="https://www.codenameone.com/developer-guide/img/reel-viewer-home.png" alt="The Reel catalog" width="1080" height="1920" /></a></p>
<p>The catalog.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/reel-viewer-player-tracks.png"><img src="https://www.codenameone.com/developer-guide/img/reel-viewer-player-tracks.png" alt="The Reel player with audio and subtitle tracks" width="1080" height="1920" /></a></p>
<p>Audio and subtitle tracks.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/reel-viewer-course.png"><img src="https://www.codenameone.com/developer-guide/img/reel-viewer-course.png" alt="A Reel course with its lessons" width="1080" height="1920" /></a></p>
<p>A course and its lessons.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/reel-moderation-queue.png"><img src="https://www.codenameone.com/developer-guide/img/reel-moderation-queue.png" alt="The Reel moderation queue" width="1080" height="1920" /></a></p>
<p>The moderation queue.</p>
<h2>One template, three businesses</h2>
<p>Reel's behavior is driven by presets you switch at run time, with no rebuild:</p>
<ul>
<li><strong>Subscription service.</strong> Plans or rentals, profiles, downloads, resume across devices.</li>
<li><strong>Creator platform.</strong> Anyone with the creator role uploads video, the server packages it, and moderators approve it before it's public. Think of a community YouTube for your niche.</li>
<li><strong>Academy.</strong> Courses, lessons and quizzes, for training and tutorials.</li>
</ul>
<p>On top of the preset, toggles turn ads, rentals, downloads, uploads, courses, quizzes and polls on or off. The server assigns roles (viewer, creator, moderator and admin) and the app shows each person the screens their role allows.</p>
<h2>Uploads and moderation</h2>
<p>Creators upload from the app and the server packages each upload for streaming and checks it against blocklists the moderators maintain. A title only goes live after a moderator approves it, and a moderator can take it down later. Takedowns take effect mid-stream: the player's heartbeat checks with the server, so a removed title stops playing instead of running to the end.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBDW0NyZWF0b3IgdXBsb2Fkc10gLS0-IFBbU2VydmVyIHBhY2thZ2VzIEhMU10KICAgIFAgLS0-IEJbQmxvY2tsaXN0IGNoZWNrc10KICAgIEIgLS0-IFFbTW9kZXJhdGlvbiBxdWV1ZV0KICAgIFEgLS0-fGFwcHJvdmV8IExbTGl2ZSBpbiB0aGUgY2F0YWxvZ10KICAgIFEgLS0-fHJlamVjdHwgUltCYWNrIHRvIHRoZSBjcmVhdG9yXQogICAgTCAtLT58dGFrZWRvd258IFhbU3RvcHMgb24gdGhlIG5leHQgaGVhcnRiZWF0XQ==?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<h2>A streaming API with DRM, in core</h2>
<p>Reel needed playback for protected video, and that belongs in the framework, not in one template. So Codename One now has a streaming API in <code>com.codename1.media</code>. It's small on purpose:</p>
<table>
<thead>
<tr>
<th>Class</th>
<th>What it does</th>
</tr>
</thead>
<tbody><tr>
<td><code>StreamRequest</code></td>
<td>An HLS manifest or a progressive file URL, plus a start position, request headers, a completion callback and an optional DRM configuration. <code>create()</code> or <code>createAsync()</code> returns an ordinary <code>Media</code>.</td>
</tr>
<tr>
<td><code>DrmConfig</code></td>
<td>The scheme and license server URL, headers sent with every license request, a FairPlay certificate URL and a content id.</td>
</tr>
<tr>
<td><code>DrmScheme</code></td>
<td><code>AES_128</code> (encrypted HLS), <code>CLEARKEY</code>, <code>WIDEVINE</code> and <code>FAIRPLAY</code>.</td>
</tr>
<tr>
<td><code>MediaManager.isDrmSupported(scheme)</code></td>
<td>Whether this device can play a scheme, asked before you open the stream.</td>
</tr>
</tbody></table>
<p>Opening a protected stream that resumes where the viewer stopped:</p>
<pre><code class="language-java">StreamRequest req = new StreamRequest(manifestUrl)
        .setStartPosition(resumeSeconds * 1000)
        .setDrm(new DrmConfig(DrmScheme.CLEARKEY, licenseUrl)
                .addLicenseHeader("X-Reel-License", licenseToken));
req.createAsync().ready(media -&gt; {
    player.add(BorderLayout.CENTER, media.getVideoComponent());
    player.revalidate();
});
</code></pre>
<p>Each port maps the scheme to what the device has: AVPlayer decrypts AES-128 HLS and plays FairPlay on Apple, and Android's player and <code>MediaDrm</code> handle AES-128 HLS, ClearKey, and Widevine where the device has it. Devices differ, so Reel asks first and sends the server the schemes this device can play, strongest first. The server picks one and returns the matching manifest and license URL:</p>
<pre><code class="language-java">List&lt;String&gt; out = new ArrayList&lt;String&gt;();
DrmScheme[] order = {DrmScheme.WIDEVINE, DrmScheme.FAIRPLAY, DrmScheme.CLEARKEY, DrmScheme.AES_128};
for (int iter = 0; iter &lt; order.length; iter++) {
    if (MediaManager.isDrmSupported(order[iter])) {
        out.add(order[iter].name());
    }
}
</code></pre>
<img src="https://mermaid.ink/img/c2VxdWVuY2VEaWFncmFtCiAgICBwYXJ0aWNpcGFudCBBcHAKICAgIHBhcnRpY2lwYW50IFNlcnZlcgogICAgcGFydGljaXBhbnQgTGljZW5zZSBhcyBMaWNlbnNlIHNlcnZlcgogICAgQXBwLT4-QXBwOiBpc0RybVN1cHBvcnRlZCBmb3IgZWFjaCBzY2hlbWUKICAgIEFwcC0-PlNlcnZlcjogcGxheSB0aXRsZSwgc3VwcG9ydGVkIHNjaGVtZXMKICAgIFNlcnZlci0tPj5BcHA6IG1hbmlmZXN0IFVSTCwgc2NoZW1lLCBsaWNlbnNlIFVSTCwgbWVkaWEgdG9rZW4KICAgIEFwcC0-PkxpY2Vuc2U6IGxpY2Vuc2UgcmVxdWVzdCArIFgtUmVlbC1MaWNlbnNlCiAgICBMaWNlbnNlLS0-PkFwcDoga2V5IChDbGVhcktleSkgb3IgbGljZW5zZSAoV2lkZXZpbmUsIEZhaXJQbGF5KQogICAgbG9vcCBldmVyeSBmZXcgc2Vjb25kcwogICAgICAgIEFwcC0-PlNlcnZlcjogaGVhcnRiZWF0LCBwb3NpdGlvbgogICAgICAgIFNlcnZlci0tPj5BcHA6IGtlZXAgcGxheWluZywgb3Igc3RvcCAodGFrZWRvd24sIHN0cmVhbSBsaW1pdCkKICAgIGVuZA==?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>Out of the box, Reel packages each video once, as AES-128 HLS and as CENC encrypted MP4 for ClearKey, under one key. Keys are issued only against a license token tied to the session, and every playlist, segment and key request carries a media token that expires and is scoped to one video and a maximum quality. Concurrent stream limits are enforced by the heartbeat. Protected video also blocks screenshots and screen recording, and can add a watermark with the account name.</p>
<p>I'll be direct about the limit: AES-128 and ClearKey stop casual copying, not a determined attacker, because the key reaches the device. For studio grade protection you plug in a Widevine or FairPlay license vendor through <code>reel.drm.widevine.url</code> and <code>reel.drm.fairplay.url</code>. The server forwards the license challenge, and the app code doesn't change.</p>
<h2>Audio tracks and subtitles</h2>
<p><a href="https://www.codenameone.com/developer-guide/img/reel-viewer-lesson-subtitles.png"><img src="https://www.codenameone.com/developer-guide/img/reel-viewer-lesson-subtitles.png" alt="A Reel lesson playing with Spanish subtitles" width="1080" height="1920" /></a></p>
<p>Subtitles over a lesson.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/reel-viewer-settings-subtitles.png"><img src="https://www.codenameone.com/developer-guide/img/reel-viewer-settings-subtitles.png" alt="Reel subtitle language and size settings" width="1080" height="1920" /></a></p>
<p>Language and size settings.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/reel-studio-video-subtitles.png"><img src="https://www.codenameone.com/developer-guide/img/reel-studio-video-subtitles.png" alt="Adding a WebVTT subtitle track in the Reel studio" width="1080" height="1920" /></a></p>
<p>A creator adds a track per language.</p>
<p>Creators add a subtitle track per language in the studio, as WebVTT. The server checks that it really is WebVTT and stores it beside the video, not inside the stream.</p>
<p>That last part is a deliberate choice. A platform player can render text tracks, but each one finds them differently, styles them differently, and some can't see a track inside an encrypted stream at all. So Reel draws subtitles itself, over the picture, and they look the same on every device and under every DRM scheme. The parser is about a hundred lines of plain Java in the template: it reads each cue's start and end time and its text, and drops WebVTT's positioning and inline tags such as <code>&lt;i&gt;</code> and <code>&lt;v Speaker&gt;</code>:</p>
<pre><code class="language-java">Captions.load(track.url(), loaded -&gt; {
    if (wanted.equals(subtitleLanguage)) {
        captions = loaded;
        updateCaption();
    }
});

private void updateCaption() {
    String text = captions == null ? "" : captions.at(media.getTime());
    if (!text.equals(caption.getText())) {
        caption.setText(text);
    }
}
</code></pre>
<p><code>captions.at(millis)</code> returns the cues that cover that moment, one per line, and the player calls it as the position moves. Switching subtitles in the player's <strong>Audio &amp; subtitles</strong> sheet takes effect at once, because nothing about the stream changes. Switching the audio language or the quality reopens the stream at the same position, and the server marks the viewer's preferred audio track as the playlist default, so it starts in the right language.</p>
<h2>Payments and the rest</h2>
<p>Payments are simulated in the dev profile; the test card 4242 4242 4242 4242 goes through. Set <code>reel.payments.provider=stripe</code> for Stripe, and store purchases are verified with Apple and Google. Push goes through the Codename One push service. Reel also runs in a browser with nothing installed, which is how many viewers will first meet your service.</p>
<figure><a href="https://www.codenameone.com/developer-guide/img/reel-viewer-home-desktop.png"><img width="2880" height="1692" src="https://www.codenameone.com/developer-guide/img/reel-viewer-home-desktop.png" alt="The Reel catalog on a desktop screen" /></a><figcaption>The same app on a desktop.</figcaption></figure>

<h2>Try it</h2>
<p>Generate Reel from the <a href="https://www.codenameone.com/initializr/">Initializr</a>. The <a href="https://www.codenameone.com/developer-guide/reel-users-guide/">user's guide</a> walks through every screen, and the <a href="https://www.codenameone.com/developer-guide/reel-implementors-guide/">implementor's guide</a> covers the packaging pipeline, DRM vendors and what to change before you launch. The template source is free under MIT-0, with no royalties and no revenue share.</p>
<p>Tomorrow: <a href="https://www.codenameone.com/blog/android-apps-everywhere-even-without-google/">GrapheneOS, LineageOS, /e/OS and Others Are Now Officially Supported</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Bastion: A Hardened Bank Template, and Crypto Wallets in Core]]></title><description><![CDATA[Bastion is a virtual bank and small exchange, app and server in one Java project, built as a reference for how to harden a financial app: passkeys, TOTP…]]></description><link>https://debugagent.com/bastion-a-hardened-bank-template-and-crypto-wallets-in-core</link><guid isPermaLink="true">https://debugagent.com/bastion-a-hardened-bank-template-and-crypto-wallets-in-core</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Mon, 09 Nov 2026 01:01:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/3ed4b8b8-3f5f-4e00-8fc4-98fc25cd3c3c.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A large share of the teams building on Codename One are banks and financial institutions. They don't ask me for a prettier list component. They ask how to pass a penetration test, what the auditor will want to see, and which protections actually work on which device.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p><strong>Bastion</strong> is my answer, written as code. It's a virtual bank and a small exchange, the app and its server in one Java project. Customers hold dollars, euros, bitcoin and ether, move money, issue and freeze cards, trade, and withdraw coins to addresses they've allowed in advance. Staff verify the ledger and the audit trail. It's a template you can brand, but mostly it's a reference: every hardening technique in it is there so you can read how it's done.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/bastion-dashboard.png"><img src="https://www.codenameone.com/developer-guide/img/bastion-dashboard.png" alt="The Bastion dashboard" width="420" height="860" /></a></p>
<p>Accounts in four currencies.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/bastion-order-book.png"><img src="https://www.codenameone.com/developer-guide/img/bastion-order-book.png" alt="The BTC/USD market with candles and the order book" width="420" height="860" /></a></p>
<p>The BTC/USD market.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/bastion-withdraw.png"><img src="https://www.codenameone.com/developer-guide/img/bastion-withdraw.png" alt="Withdrawing coins to an allow-listed address" width="420" height="860" /></a></p>
<p>Withdrawals to allowed addresses.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/bastion-security-center.png"><img src="https://www.codenameone.com/developer-guide/img/bastion-security-center.png" alt="The Bastion Security Center" width="420" height="860" /></a></p>
<p>What is on, on this device.</p>
<h2>Defense in layers</h2>
<p>No single protection makes an app secure. Bastion stacks them, so an attacker who gets past one meets the next.</p>
<p><strong>Signing in.</strong> OAuth authorization code with PKCE, five minute access tokens and rotating twelve hour refresh tokens. A TOTP second factor with ten recovery codes, plus WebAuthn passkeys. Once an account has a passkey, Bastion requires the strongest factor it has. Lockouts and per address rate limits slow down guessing, and changing the password ends every other session.</p>
<p><strong>The device.</strong> On first sign in, the app generates a P-256 key pair, registers the public key with the server, and seals the private key with AES-256-GCM under a key kept in the Keychain or Keystore. The app locks after 30 seconds in the background or two minutes idle, and unlocks with biometrics, then a PIN, then a full sign in.</p>
<p><strong>Every request that moves money is signed.</strong> Not just authenticated with a token. Signed with the device key, over a canonical form that includes a timestamp and a single use nonce:</p>
<pre><code class="language-java">String text = SignedRequest.canonical(method, target, Hash.sha256(body),
        idempotencyKey, nonce, ts);
byte[] der = Signature.sign(Signature.SHA256_WITH_ECDSA, privateKey, utf8(text));
return SignedRequest.header(deviceId, ts, nonce, Base64.encodeUrlSafe(jose(der)));
</code></pre>
<p>A stolen access token can't move money without the device key. A captured request can't be replayed, because the nonce is spent.</p>
<img src="https://mermaid.ink/img/c2VxdWVuY2VEaWFncmFtCiAgICBwYXJ0aWNpcGFudCBBcHAKICAgIHBhcnRpY2lwYW50IFNlcnZlcgogICAgQXBwLT4-QXBwOiBjYW5vbmljYWwgZm9ybTogbWV0aG9kLCBwYXRoLCBib2R5IGhhc2gsIG5vbmNlLCB0aW1lCiAgICBBcHAtPj5BcHA6IHNpZ24gd2l0aCB0aGUgZGV2aWNlIGtleSAoUC0yNTYpCiAgICBBcHAtPj5TZXJ2ZXI6IHJlcXVlc3QgKyB0b2tlbiArIEJhc3Rpb24tU2lnbmF0dXJlCiAgICBTZXJ2ZXItPj5TZXJ2ZXI6IHRva2VuIHZhbGlkPyBkZXZpY2UgcmVnaXN0ZXJlZD8KICAgIFNlcnZlci0-PlNlcnZlcjogc2lnbmF0dXJlIHZhbGlkPyBub25jZSB1bnVzZWQ_IGNsb2NrIGluIHJhbmdlPwogICAgU2VydmVyLT4-U2VydmVyOiBsaW1pdHMsIHBheWVlIGNvb2xpbmctb2ZmLCBzdGVwLXVwCiAgICBTZXJ2ZXItLT4-QXBwOiBwb3N0ZWQgdG8gdGhlIGxlZGdlciwgYXBwZW5kZWQgdG8gdGhlIGF1ZGl0IGNoYWlu?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p><strong>The network.</strong> The app refuses cleartext, talks only to an allow list of hosts, and pins their certificates. That's <code>AppShield</code>, a Codename One API, configured in a few lines:</p>
<pre><code class="language-java">ShieldConfig shield = new ShieldConfig().collectSignals(true);
for (String host : AppConfig.ALLOWED_HOSTS) {
    shield.protect(host, HostPolicy.ENFORCED);
}
AppShield.init(shield);
</code></pre>
<p><strong>The screen.</strong> Secure windows that keep sensitive screens out of screenshots and the app switcher, tapjacking protection, and a clipboard that clears itself after you copy an account number.</p>
<p><strong>Limits.</strong> Per transfer and daily limits, a cooling-off period for new payees, step up authentication above a threshold, and an allow list for crypto withdrawals.</p>
<h2>The Security Center tells the truth</h2>
<p>Most security settings screens show a column of green checks. Bastion's Security Center shows what's actually on for this device and this build. Some protections need a cloud build: code obfuscation with string encryption and control flow flattening (<code>cn1.hardenLevel=aggressive</code>), Play Integrity, jailbreak detection, and blocking screenshots when the app goes to the background. When those aren't active, the Security Center labels them "Cloud build" rather than showing a green check. A test keeps that screen in sync with the build hints, so it can't drift into a lie.</p>
<h2>The back office auditors want</h2>
<p>Money is a double entry ledger, not a balance column. The admin console has the journal, T-accounts, a trial balance, a balance sheet, an income statement, reconciliation, period close and a maker checker approvals queue. Every event lands in a hash chained audit log, and the console can verify the chain and export evidence as CSV. A read only auditor role sees all of it, on a desktop or on a phone.</p>
<figure><a href="https://www.codenameone.com/developer-guide/img/bastion-console-overview.png"><img width="1440" height="900" src="https://www.codenameone.com/developer-guide/img/bastion-console-overview.png" alt="The Bastion admin console overview on the desktop" /></a><figcaption>The back office console.</figcaption></figure>

<h2>Crypto wallets, exchanges and custody, in core</h2>
<p>I'm not a fan of crypto currency. I know plenty of people who are, and a few of them are customers. We're here to serve, and if we serve, we should be the best at it. So this isn't a wallet library bolted on the side. It's a big feature: everything a wallet, an exchange or a custodian needs, in core, with no third party library, and the same classes run in the app and in a Codename One backend.</p>
<table>
<thead>
<tr>
<th>Package</th>
<th>What's in it</th>
</tr>
</thead>
<tbody><tr>
<td><code>crypto.hd</code></td>
<td>BIP-39 recovery phrases, BIP-32 and SLIP-10 derivation, <code>DerivationPath</code></td>
</tr>
<tr>
<td><code>crypto.evm</code></td>
<td>EIP-55 addresses; legacy, EIP-2930 and EIP-1559 transactions; EIP-191 and EIP-712 signing; the Solidity ABI and ERC-20</td>
</tr>
<tr>
<td><code>crypto.bitcoin</code></td>
<td>P2PKH, P2SH, P2WPKH, P2WSH and Taproot addresses, scripts, transactions, PSBT and WIF</td>
</tr>
<tr>
<td><code>crypto.solana</code></td>
<td>Transactions, the system and SPL token programs, priority fees</td>
</tr>
<tr>
<td><code>crypto.wallet</code></td>
<td><code>Wallet</code>, <code>Signer</code>, <code>SeedSigner</code> and <code>VaultSigner</code></td>
</tr>
<tr>
<td><code>crypto.rpc</code></td>
<td>EVM JSON-RPC, Esplora for Bitcoin, Solana JSON-RPC</td>
</tr>
<tr>
<td><code>crypto.market</code></td>
<td>Price feeds: CoinGecko, any JSON price API, and a caching decorator</td>
</tr>
</tbody></table>
<h3>A wallet</h3>
<p>One recovery phrase gives you addresses on every chain, and they match MetaMask, Electrum, Sparrow and Phantom on the standard paths, so a user can restore the same phrase in another wallet and find the same money:</p>
<pre><code class="language-java">String words = Mnemonic.generate(256);           // 24 words
Wallet wallet = Wallet.fromMnemonic(words, "");
EvmAddress eth = wallet.getEvmAddress(0, 0);                 // m/44'/60'/0'/0/0
BitcoinAddress btc = wallet.getBitcoinAddress(BitcoinNetwork.MAINNET,
        Wallet.BIP84, 0, 0, 0);                              // bc1q...
SolanaAddress sol = wallet.getSolanaAddress(0);              // m/44'/501'/0'/0'
</code></pre>
<p>Bitcoin covers legacy, nested SegWit, native SegWit and Taproot, on the main network and on every test network. Sending ether is an EIP-1559 transaction with the fees the node suggests:</p>
<pre><code class="language-java">EvmRpc rpc = new EvmRpc(new NetworkTransport(), "https://ethereum-sepolia-rpc.publicnode.com");
DerivationPath path = Wallet.evmPath(0, 0);
EvmAddress from = wallet.getEvmAddress(path);
long nonce = rpc.getTransactionCount(from, "pending");
UInt256[] fees = rpc.suggestFees();                     // {tip, fee cap}
long gas = rpc.estimateGas(from, to, value, null);

EvmTransaction tx = EvmTransaction.eip1559(rpc.chainId(), nonce, fees[0], fees[1],
        gas, to, value, null);
String hash = rpc.sendRawTransaction(wallet.signEvmTransaction(tx, path));
</code></pre>
<p>Bitcoin goes through a PSBT, so the same code works with a hardware signer that only sees the partially signed transaction. Taproot inputs are signed with BIP-340 Schnorr automatically:</p>
<pre><code class="language-java">EsploraClient.Utxo coin = esplora.getUtxos(from).get(0);
BitcoinTransaction tx = new BitcoinTransaction();
tx.addInput(coin.getTxid(), coin.getVout());
tx.addOutput(coin.getValue() - feeSats, BitcoinAddress.parse(recipient, net));

Psbt psbt = Psbt.fromTransaction(tx);
psbt.setWitnessUtxo(0, coin.toOutput());
psbt.signAll(wallet.getBitcoinKey(path));
psbt.finalizeAll();
String txid = esplora.broadcast(psbt.extract());
</code></pre>
<p>Keys are handled the way a security review expects. <code>VaultSigner</code> keeps the phrase sealed behind biometrics or a password and refuses to sign while it's locked. <code>revealMnemonic</code> returns a <code>char[]</code> you can wipe, not a <code>String</code> that lingers on the heap, and <code>SeedSigner.destroy()</code> wipes the key.</p>
<h3>An exchange</h3>
<p>An exchange is mostly the server side, and that's what Bastion's backend shows. It derives a deposit address per customer (<code>m/44'/60'/0'/0/n</code>), scans new blocks, credits deposits once they're deep enough, and sweeps them to a hot wallet on a separate account. It stops scanning and writes an audit event on a reorganization deeper than its confirmation depth. Before every withdrawal it checks that reserves cover what customers hold, and withdrawals go only to addresses the customer allowed in advance. Order prices are collared against the index price, so a fat finger can't sell bitcoin for a dollar.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBEW0N1c3RvbWVyIGRlcG9zaXQgYWRkcmVzc10gLS0-IFNbQmxvY2sgc2Nhbm5lcl0KICAgIFMgLS0-fGNvbmZpcm1lZHwgQ1tDcmVkaXQgdGhlIGxlZGdlcl0KICAgIEMgLS0-IEhbU3dlZXAgdG8gdGhlIGhvdCB3YWxsZXRdCiAgICBXW1dpdGhkcmF3YWwgcmVxdWVzdF0gLS0-IExbTGltaXRzLCBhbGxvdyBsaXN0LCBzdGVwIHVwXQogICAgTCAtLT4gUntSZXNlcnZlcyBjb3ZlciBpdD99CiAgICBSIC0tPnx5ZXN8IFRbU2lnbiwgd2lwZSB0aGUga2V5LCBicm9hZGNhc3RdCiAgICBSIC0tPnxub3wgQVtBdWRpdCBldmVudCwgcmVmdXNlZF0=?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>Every one of those steps lands in the double entry ledger and the hash chained audit log from the previous section, which is what lets the auditor trace a coin from deposit to withdrawal.</p>
<h3>Performance</h3>
<p>The expensive parts (secp256k1, Schnorr, Ed25519, the hashes and PBKDF2) run as native C on iOS, macOS, Android, Windows and Linux, with a portable Java engine as the fallback. CI benchmarks every kernel against libsecp256k1, OpenSSL and BouncyCastle on the same machine, and a pull request that makes one slower fails.</p>
<figure><img src="https://www.codenameone.com/developer-guide/img/crypto-bench-ratios.png" alt="Codename One throughput as a multiple of the reference library's, on the JVM, native and Android" /><figcaption>Throughput as a multiple of the reference library. Above 1 is faster.</figcaption></figure>

<p>Natively, ECDSA signing matches libsecp256k1 (60,770 against 59,453 signatures a second), and Ed25519 signs 2.44 times as fast as OpenSSL. Even the portable Java engine, which the simulator uses, beats BouncyCastle on the JVM: 1.76 times on public key derivation, 1.49 on ECDSA signing, and 20 times the JDK's own Ed25519 provider. On Android the native engine verifies ECDSA signatures six times as fast as BouncyCastle on ART:</p>
<figure><img src="https://www.codenameone.com/developer-guide/img/crypto-bench-android.png" alt="Both Android engines as a multiple of BouncyCastle on ART" /><figcaption>Android: the native and Java engines against BouncyCastle on ART.</figcaption></figure>

<p>A phone signs one transaction at a time. An exchange or an indexer checks thousands of signatures at once, so <code>CryptoBatch</code> takes a whole batch:</p>
<pre><code class="language-java">boolean[] valid = CryptoBatch.verifySecp256k1(hashes, signatures, publicKeys);
</code></pre>
<p>It spreads the batch across every core, and for large batches the GPU too: Metal on Apple, Vulkan elsewhere and WebGPU in the browser, split by measured speed. The GPU never sees a private key. On every core, a batch of 1,024 verifies ECDSA 7.46 times as fast as libsecp256k1 called once per signature, and Ed25519 15.6 times as fast. In the browser, WebGPU verifies ECDSA 8.5 times as fast as the portable engine.</p>
<figure><img src="https://www.codenameone.com/developer-guide/img/crypto-bench-multicore.png" alt="A native batch on every core as a multiple of the reference library called once per entry" /><figcaption>A batch on every core, against the reference library one call at a time.</figcaption></figure>

<figure><img src="https://www.codenameone.com/developer-guide/img/crypto-bench-gpu.png" alt="Signatures verified per second by the CPU, the GPU and both together" /><figcaption>CPU, GPU and both together on an M4 Max.</figcaption></figure>

<p>The GPU's gain on a machine with 12 fast cores is modest, up to 1.63 times for Ed25519, and the chapter says so. Where it pays is a smaller CPU and the browser. Every table and chart is in the <a href="https://www.codenameone.com/developer-guide/crypto-wallets/">crypto wallets chapter</a>, with the machine, the library versions and how to rerun them.</p>
<h2>What's simulated</h2>
<p>Bastion is a reference, not a licensed bank. Deposits, card spending and the market (a random walk) are simulated, and Android integrity checks trust every device in the dev profile. There's no KYC or sanctions screening, no payment rail, no HSM and no regulatory reporting. The <a href="https://www.codenameone.com/developer-guide/bastion-implementors-guide/">implementor's guide</a> has a section for each of those that says what a production deployment needs. On the crypto side, ether can settle on a real Ethereum node, while bitcoin stays a ledger balance in the sample. Only the three chain families above are supported, and the node clients are blocking calls, so keep them off the UI thread.</p>
<h2>Try it</h2>
<p>Generate Bastion from the <a href="https://www.codenameone.com/initializr/">Initializr</a>, or run it from the repository:</p>
<pre><code class="language-bash">CN1_PROFILE=dev backend/server.sh run
mvn verify -Psimulator -DskipTests -Dcodename1.platform=javase
</code></pre>
<p>Sign in as <code>customer@bastion.example</code> with the password <code>bastion-demo-password</code>, then open the Security Center and see what your build actually protects.</p>
<p>Tomorrow: <a href="https://www.codenameone.com/blog/reel-streaming-and-courses-template/">Reel: Your Own Streaming Service or Course Platform</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Your Swing and JavaFX Code on iPhone, Android and the Web]]></title><description><![CDATA[Codename One now builds a large share of Swing, SwingX and JavaFX application code for iOS, Android, the web and native desktop. It can't run everything…]]></description><link>https://debugagent.com/your-swing-and-javafx-code-on-iphone-android-and-the-web</link><guid isPermaLink="true">https://debugagent.com/your-swing-and-javafx-code-on-iphone-android-and-the-web</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Sun, 08 Nov 2026 01:01:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/33495c9b-d253-4a26-854e-2435b0fc15d0.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>There's a lot of Swing and JavaFX code in the world. Much of it is internal tooling and line of business software that works fine and that nobody wants to rewrite. Then someone asks for it on an iPad, or in a browser, and the answer has always been "rewrite it."</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>Codename One can now build a large share of that code for iOS, Android, the web and native desktop, as a native app with no JVM inside. SwingSet2 and Notepad, the JDK's own demos, both build and run. This post shows what carries over, what it costs in size and start-up (less than the JVM), and why the parts that don't carry over have better replacements in a client app.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/desktop-compat-swingset2.png"><img src="https://www.codenameone.com/developer-guide/img/desktop-compat-swingset2.png" alt="SwingSet2, the JDK Swing demo, running as a Codename One app on an iPad" width="918" height="1300" /></a></p>
<p>SwingSet2, the JDK demo, on an iPad.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/desktop-compat-fx2048.png"><img src="https://www.codenameone.com/developer-guide/img/desktop-compat-fx2048.png" alt="The open source JavaFX 2048 game running as a Codename One app on an Android phone" width="642" height="1300" /></a></p>
<p>The JavaFX 2048 game on a phone.</p>
<h2>What it does</h2>
<p>You drop the project's <code>src/main</code> into a Codename One project, or import it:</p>
<pre><code class="language-bash">mvn cn1:import-desktop-project -Dcn1.desktop.import=/path/to/MyDesktopApp
</code></pre>
<p>Your code keeps compiling against the JDK's own Swing, or against our JavaFX API under the real <code>javafx.*</code> names. A remap step after javac points the bytecode at our implementations of <code>java.awt</code>, <code>javax.swing</code>, <code>java.beans</code>, <code>javax.imageio</code>, a SwingX subset and a JavaFX subset, all written on top of Codename One. FXML files compile to Java classes at build time, and JavaFX CSS compiles to a table. Nothing parses XML on the device.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBTW1lvdXIgU3dpbmcgLyBKYXZhRlggc291cmNlXSAtLT4gSltqYXZhYyBhZ2FpbnN0IHRoZSB1c3VhbCBBUElzXQogICAgSiAtLT4gUltyZW1hcDogamF2YS5hd3QsIGphdmF4LnN3aW5nLCBqYXZhZnggdG8gQ29kZW5hbWUgT25lXQogICAgRlsuZnhtbCBhbmQgLmNzc10gLS0-IFhbY29tcGlsZWQgYXQgYnVpbGQgdGltZV0KICAgIFIgLS0-IENbY29tcGxpYW5jZSBjaGVjazogdW5zdXBwb3J0ZWQgQVBJIGlzIGEgYnVpbGQgZXJyb3JdCiAgICBYIC0tPiBDCiAgICBDIC0tPiBQW1BhcnBhclZNIG5hdGl2ZSBidWlsZHNd?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p><a href="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-swing-controls.png"><img src="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-swing-controls.png" alt="Swing controls running on an iPhone" width="589" height="1278" /></a></p>
<p>Swing controls.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-swing-tables.png"><img src="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-swing-tables.png" alt="A JTable and a JXTable running on an iPhone" width="589" height="1278" /></a></p>
<p>JTable and JXTable.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-javafx-controls.png"><img src="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-javafx-controls.png" alt="JavaFX controls running on an iPhone" width="589" height="1278" /></a></p>
<p>JavaFX controls.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-javafx-fxml.png"><img src="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-javafx-fxml.png" alt="An FXML form styled with CSS running on an iPhone" width="589" height="1278" /></a></p>
<p>FXML with its CSS.</p>
<p>Unmodified desktop code on an iPhone, captured by our screenshot tests.</p>
<p>Our test set includes two JDK demos, SwingSet2 and Notepad, along with a Swing gallery, a falling blocks game, a JavaFX gallery, an open source 2048 game, an address book and a Mandelbrot explorer.</p>
<h2>The numbers</h2>
<p>On Linux, the same app as a <code>jlink</code> image against a Codename One native build:</p>
<table>
<thead>
<tr>
<th>Application</th>
<th>JVM image, zipped</th>
<th>Native, zipped</th>
<th>Smaller by</th>
</tr>
</thead>
<tbody><tr>
<td>SwingSet2, the JDK demo</td>
<td>34.1 MB</td>
<td>8.2 MB</td>
<td>4.2x</td>
</tr>
<tr>
<td>Notepad, the JDK demo</td>
<td>32.8 MB</td>
<td>6.5 MB</td>
<td>5.0x</td>
</tr>
<tr>
<td>JavaFX gallery</td>
<td>39.1 MB</td>
<td>7.1 MB</td>
<td>5.5x</td>
</tr>
<tr>
<td>Address book (JavaFX)</td>
<td>39.1 MB</td>
<td>6.5 MB</td>
<td>6.0x</td>
</tr>
</tbody></table>
<figure><img src="https://www.codenameone.com/developer-guide/img/desktop-compat-linux-size-zipped.png" alt="Zipped download size on Linux: a jlink JVM image against the Codename One native build, per sample" /><figcaption>Download size, zipped.</figcaption></figure>

<figure><img src="https://www.codenameone.com/developer-guide/img/desktop-compat-linux-startup-cold.png" alt="Cold start on Linux: each sample on the default JVM, a tuned JVM and the Codename One native build" /><figcaption>Cold start on Linux.</figcaption></figure>

<p>From process start to the first painted frame, the native build starts faster than the default JVM in all 8 apps, by 1.5x to 5.5x. Against a JVM tuned with the serial GC, C1 only and an AppCDS archive, it's still faster in all 8, by 1.1x to 3.6x. The closest is the falling blocks game, at 86 ms native against 93 ms tuned. The JavaFX gallery starts in 116 ms native against 637 ms on the default JVM. The same apps build for iOS at 25 to 29 MB and as 2.8 to 4.4 MB Android APKs.</p>
<p>Memory is closer than you might expect. At idle the native Swing gallery holds 64.5 MB resident against 84.2 MB on a tuned JVM. After a scripted session of clicks and drags it's 90.8 MB against 86.0 MB.</p>
<h2>What isn't supported</h2>
<p>This is the important part, so here it is without softening:</p>
<ul>
<li><strong>No binary drop in.</strong> A third party jar that was compiled against <code>java.awt</code>, <code>javax.swing</code> or <code>javafx</code> fails the build. We don't relocate other people's jars. If the library ships source, you can bring the source.</li>
<li><strong>No class loaders,</strong> <code>ServiceLoader</code><strong>, modules or OSGi.</strong></li>
<li><strong>No runtime reflection.</strong> <code>java.lang.reflect</code> and <code>Class.getMethod</code> are build errors. <code>Class.forName</code> by string doesn't work on Android or the web.</li>
<li><strong>No Java serialization,</strong> <code>HttpURLConnection</code><strong>,</strong> <code>java.net.http</code> <strong>or raw sockets</strong> through these layers.</li>
<li><code>ProcessBuilder</code> <strong>doesn't exist on a phone.</strong> Check <code>ProcessBuilder.isSupported()</code>.</li>
<li><strong>Only a subset of the API.</strong> Swing is big. When you call something we don't have, the build tells you exactly what and where:</li>
</ul>
<pre><code class="language-plaintext">com/example/OrdersPanel#restyleTree()V -&gt; javax.swing.JTree.getUI() is not
supported by the Codename One Swing compatibility layer
(com/example/OrdersPanel.class) at OrdersPanel.java:48
</code></pre>
<p>That error is the point. You find out at build time, on your machine, with a file and line number. You don't find out from a user on an iPad.</p>
<h2>Why pay for what you don't need?</h2>
<p>Look at that list again and ask where those features show up in a typical desktop app. Reflection usually powers a binding framework, a serialization library or a dependency injector. Class loaders power plugins. Serialization powers a cache or a save file.</p>
<p>Codename One does those jobs at build time instead. Binding a form to a model is generated code, with no reflection and no listener bookkeeping:</p>
<pre><code class="language-java">@Bindable
public class LoginModel {
    @Bind(name = "userField", attr = BindAttr.TEXT)
    @Required
    private String user;
    public String getUser()         { return user; }
    public void   setUser(String u) { this.user = u; }

    @Bind(name = "rememberMe", attr = BindAttr.SELECTED)
    public boolean remember;
}
</code></pre>
<p>The same goes for JSON and XML mapping, REST and GraphQL clients and the SQLite ORM. They're all generated by the build, so they're type checked, they survive dead code elimination, and they cost nothing at startup. Reflection is what makes a JVM app big and slow to start. Removing it is a large part of why the native build is 4 to 6 times smaller.</p>
<h2>What desktop Java never gave you</h2>
<p>You don't have to wait for a phone to get something out of this. On the desktop, today, the same app picks up things Swing developers have fought for years to get, and that JavaFX offers only as its own aging WebKit fork:</p>
<ul>
<li><strong>A real browser.</strong> <a href="https://www.codenameone.com/developer-guide/working-with-javascript/"><code>BrowserComponent</code></a> embeds the system's engine: WebKit on the Mac, WebView2 on Windows and WebKitGTK on Linux, with two way calls between Java and JavaScript. No bundled Chromium, no <code>JEditorPane</code> rendering HTML 3.2.</li>
<li><strong>The camera.</strong> <a href="https://www.codenameone.com/developer-guide/miscellaneous-features/#_capture_photos_video_audio"><code>Capture</code></a> takes photos and video from the webcam on macOS, Windows and Linux. In Swing that has meant a native library and a prayer.</li>
<li><strong>Bluetooth LE.</strong> The <a href="https://www.codenameone.com/developer-guide/bluetooth/">Bluetooth API</a> talks to real devices on all three desktops, so the tool that configures your hardware no longer needs a vendor SDK or a serial port bridge.</li>
<li><strong>Maps.</strong> A <a href="https://www.codenameone.com/developer-guide/maps/">vector <code>MapView</code></a> drawn by Codename One itself, with markers and shapes, the same on the desktop as on a phone.</li>
<li><strong>The web.</strong> The same app builds for the browser, so the internal tool people install today can also be a link, with nothing installed.</li>
<li><strong>Generated network clients.</strong> Point <a href="https://www.codenameone.com/developer-guide/maven-appendix-goals/#_generate_openapi_client_generate_openapi"><code>cn1:generate-openapi</code></a> at an OpenAPI 3 spec and you get a typed client. GraphQL and gRPC have goals of their own, and <a href="https://www.codenameone.com/developer-guide/authentication-and-identity/">OAuth and sign in with Google or Apple</a> are built in.</li>
<li><strong>SQLite with an ORM</strong> whose mapping mistakes fail the build, <strong>CSS styling</strong> with light and dark themes and live reload, and <strong>a Java backend</strong> in the same project, sharing your types.</li>
</ul>
<p>And when the app does reach a phone, <a href="https://www.codenameone.com/developer-guide/push-notifications/">push</a>, <a href="https://www.codenameone.com/developer-guide/biometric-authentication/">biometrics</a>, <a href="https://www.codenameone.com/developer-guide/near-field-communication/">NFC</a> and <a href="https://www.codenameone.com/developer-guide/miscellaneous-features/#_location_gps">location</a> are there too.</p>
<p><code>SwingInterop.asComponent()</code> and <code>FxInterop.asComponent()</code> wrap a Swing component or a JavaFX node as a Codename One component, so you can migrate one panel at a time and put a Codename One map or camera view next to your existing table.</p>
<h2>Try it</h2>
<p>The <a href="https://www.codenameone.com/developer-guide/desktop-interop/">desktop compatibility chapter</a> has the full list of what's covered, the import steps and the benchmark method. Start with the screen your users ask for on mobile, run the import and read the build errors. They'll tell you how far you are.</p>
<p>Tomorrow: <a href="https://www.codenameone.com/blog/bastion-hardened-bank-template/">Bastion: A Hardened Bank Template, and Crypto Wallets in Core</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Your Compose Code, on More Screens and Less CPU]]></title><description><![CDATA[Kotlin Multiplatform code with Compose now builds as a Codename One app. The Compose runtime ships as it is, the UI layer is ours, and on our benchmark…]]></description><link>https://debugagent.com/your-compose-code-on-more-screens-and-less-cpu</link><guid isPermaLink="true">https://debugagent.com/your-compose-code-on-more-screens-and-less-cpu</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Sat, 07 Nov 2026 01:01:03 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/64a9994e-b5ca-433e-b1fb-b0d44caa71c9.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If Codename One didn't exist, Kotlin Multiplatform is probably the platform I'd choose. I prefer Java, but Kotlin is a good language, and KMP was one of the strongest platforms we measured against in the <a href="https://www.codenameone.com/blog/flutter-better-in-java/">Flutter post</a> this week. Its first take on UI leaned on heavyweight native widgets, the way React Native does. The team learned from that, and Compose Multiplatform today is a good product built by people who care about performance.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>So this post isn't about KMP being bad. KMP is good. This is also good, and in a few ways better. Your Compose code now builds as a Codename One app, so it reaches more targets and did less work per frame on our benchmark. You don't have to pick one forever: the same <code>commonMain</code> builds both ways.</p>
<h2>What you keep</h2>
<p>There's no transpiler here. kotlinc compiles your Kotlin for the JVM with the Compose compiler plugin, exactly as it does today. The Compose runtime and <code>kotlinx.coroutines</code> are the upstream jars. The UI layer (<code>androidx.compose.ui</code>, <code>foundation</code>, <code>material3</code> and <code>animation</code>) is our reimplementation, written over Codename One components and graphics. Then ParparVM compiles everything ahead of time to a native binary.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBDW2NvbW1vbk1haW4gS290bGluICsgQ29tcG9zZV0gLS0-IEtba290bGluYyArIENvbXBvc2UgcGx1Z2luXQogICAgSyAtLT4gUltDb21wb3NlIHJ1bnRpbWUsIHVubW9kaWZpZWRdCiAgICBLIC0tPiBVW0NvbXBvc2UgVUkgbGF5ZXIsIENvZGVuYW1lIE9uZV0KICAgIFIgLS0-IFBbUGFycGFyVk0sIGFoZWFkIG9mIHRpbWVdCiAgICBVIC0tPiBQCiAgICBQIC0tPiBJW2lPU10KICAgIFAgLS0-IEFbQW5kcm9pZF0KICAgIFAgLS0-IERbbWFjT1MgLyBXaW5kb3dzIC8gTGludXgsIG5vIEpWTV0KICAgIFAgLS0-IFdbV2ViXQogICAgUCAtLT4gVFt3YXRjaE9TIC8gdHZPU10=?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p><code>Dispatchers.Main</code> is the Codename One event dispatch thread, so your coroutines behave the way you expect. Measuring follows Compose's rules: the modifier chain is walked outermost first, under Compose constraints. <code>LazyColumn</code> and <code>LazyRow</code> compose only what's on screen.</p>
<p>Bringing a KMP module over is one command:</p>
<pre><code class="language-bash">mvn cn1:import-kmp-project -Dcn1.kmp.import=/path/to/MyKmpApp
</code></pre>
<p>It copies <code>commonMain</code> and your JVM source set into <code>common/src/main/kmp</code>, leaving out the file that opens a desktop window. A whole app is a <code>ComposeForm</code>:</p>
<pre><code class="language-kotlin">class MyApp : Lifecycle() {
    override fun runApp() {
        ComposeForm { LayoutScreen() }.show()
    }
}
</code></pre>
<h2>The numbers, and what they don't mean</h2>
<p>The benchmark is Keynote, a Compose conference schedule app, built three ways: Compose on Codename One, Compose Multiplatform, and the same app written in plain Java on Codename One. All three were release builds on an iPhone 17 Pro simulator with Xcode 27, five runs each.</p>
<figure><a href="https://www.codenameone.com/developer-guide/img/kmp-keynote-schedule.png"><img width="1024" height="907" src="https://www.codenameone.com/developer-guide/img/kmp-keynote-schedule.png" alt="The Keynote schedule rendered by Compose Multiplatform on the left and by Codename One on the right" /></a><figcaption>Keynote: Compose Multiplatform on the left, Codename One on the right.</figcaption></figure>

<table>
<thead>
<tr>
<th></th>
<th>Compose on Codename One</th>
<th>Java on Codename One</th>
<th>Compose Multiplatform</th>
</tr>
</thead>
<tbody><tr>
<td>Executable, stripped</td>
<td>16.8 MB</td>
<td>8.9 MB</td>
<td>22.9 MB</td>
</tr>
<tr>
<td>App bundle</td>
<td>18.3 MB</td>
<td>10.2 MB</td>
<td>22.9 MB</td>
</tr>
<tr>
<td>Cold start</td>
<td>961 ms</td>
<td>805 ms</td>
<td>1008 ms</td>
</tr>
<tr>
<td>Warm start, median</td>
<td>580 ms</td>
<td>572 ms</td>
<td>604 ms</td>
</tr>
<tr>
<td>Recomposition on a day change, median</td>
<td>4.58 ms</td>
<td>1.49 ms</td>
<td>19.24 ms</td>
</tr>
<tr>
<td>Scroll work per frame, median</td>
<td>4.04 ms</td>
<td>1.76 ms</td>
<td>17.03 ms</td>
</tr>
<tr>
<td>Frame interval, median</td>
<td>35.45 ms</td>
<td>34.79 ms</td>
<td>33.35 ms</td>
</tr>
<tr>
<td>Memory footprint</td>
<td>47 MB</td>
<td>47 MB</td>
<td>48 MB</td>
</tr>
</tbody></table>
<figure><img src="https://www.codenameone.com/blog/release-2026-10-30/kmp-keynote.svg" alt="Bar charts of recomposition time, scroll work per frame, executable size and cold start for the three builds" /><figcaption>Lower is better in every panel.</figcaption></figure>

<p>All three apps hit the same frame rate, and Compose Multiplatform is slightly ahead there. On a fast machine, a simple screen keeps up either way. What differs is how much CPU each one burns to get there: about 4 ms a frame for Compose on Codename One against about 17 ms for Compose Multiplatform. On a phone that's battery life, heat, and headroom for the frame where your screen isn't simple.</p>
<p>A few caveats, because they matter:</p>
<ul>
<li>This is the simulator, not a phone. Scrolling is programmatic, not a finger fling.</li>
<li>Compose Multiplatform's first frame marker fires before Skia draws, so the start-up figures lean in its favor.</li>
<li>An empty UIKit app takes 640 to 750 ms to start in this setup, so most of every start-up figure is iOS itself.</li>
</ul>
<h2>Why imperative Java is faster and smaller still</h2>
<p>Look at the middle column. The same screen, written imperatively in Java, handles a day change in 1.49 ms, a third of the Compose version on the same engine, and its executable is about half the size.</p>
<p>The benchmark is tilted toward Compose, too. The Java version was written to mirror the Compose app screen for screen, so it rebinds cards the way a recomposition would, and carries some of that model's overhead. A Java screen written from scratch the Codename One way would do less.</p>
<p>Declarative UI pays for its model by recomposing, diffing and remembering, which is work an imperative screen never does, because it changes the one label that changed. The usual argument is that the model buys you something back. Here is the same session card both ways. Compose:</p>
<pre><code class="language-kotlin">@Composable
fun SessionCard(s: Session, favorite: Boolean, onFavorite: () -&gt; Unit, onOpen: () -&gt; Unit) {
    Card(onOpen, Modifier.fillMaxWidth()) {
        Row(verticalAlignment = Alignment.CenterVertically) {
            Box(Modifier.width(6.dp).height(84.dp).background(Color(s.track.color)))
            Column(Modifier.weight(1f).padding(12.dp)) {
                Text(s.timeLabel + "  -  " + s.room, style = MaterialTheme.typography.labelMedium)
                Text(s.title, style = MaterialTheme.typography.titleMedium, maxLines = 2)
                Text(s.speaker.name + ", " + s.speaker.company,
                    style = MaterialTheme.typography.bodySmall)
            }
            FavoriteButton(favorite, onFavorite)
        }
    }
}
</code></pre>
<p>Codename One, with the styling in CSS where it belongs:</p>
<pre><code class="language-java">class SessionCard extends Container {
    private final Label time = new Label("", "SessionTime");
    private final Label title = new Label("", "SessionTitle");
    private final Label speaker = new Label("", "SessionSpeaker");
    private final Button heart = new Button("", "Favorite");
    private Session session;

    SessionCard(Schedule app) {
        super(new BorderLayout(), "SessionCard");
        add(BorderLayout.CENTER, BoxLayout.encloseY(time, title, speaker));
        add(BorderLayout.EAST, heart);
        heart.addActionListener(e -&gt; app.toggleFavorite(session));
    }

    void bind(Session s) {
        session = s;
        time.setText(s.timeLabel() + "  -  " + s.room);
        title.setText(s.title);
        speaker.setText(s.speaker + ", " + s.company);
    }
}
</code></pre>
<p>Put them side by side and the claimed advantages don't hold up:</p>
<ul>
<li><strong>Readability.</strong> Both are a box with three lines of text and a button. Neither is shorter in any way that matters. The Java version names its parts, so <code>title</code> is a field you can find, not the second <code>Text</code> call in a nested lambda.</li>
<li><strong>Testability.</strong> Compose tests find nodes by test tags you add for the purpose. A Codename One test holds the component, calls <code>bind</code>, and asserts on <code>title.getText()</code>. The <a href="https://www.codenameone.com/developer-guide/testing-with-junit/">test framework</a> and the simulator's MCP tools drive both the same way.</li>
<li><strong>Debugging.</strong> This is where imperative code wins outright. Set a breakpoint in <code>bind</code> and you see the one call that changed the text, with a stack that leads back to your code. In Compose, the same change runs through the snapshot system, the runtime that schedules recomposition, and generated code from the compiler plugin, and "why did this recompose?" is a question you need a dedicated tool to answer.</li>
</ul>
<p>Compose is a fine way to write UI, and if your team already has it, bring it. But it isn't simpler than the imperative code it replaced, and on this screen it costs two to three times the CPU and twice the binary. Codename One lets you choose per screen. Keep Compose where you have it, and write the hot screen in Java:</p>
<pre><code class="language-kotlin">val form = Form("Mixed", BorderLayout())
form.add(BorderLayout.NORTH, Label("Codename One"))
form.add(BorderLayout.CENTER, ComposeView { ListScreen() })
form.show()
</code></pre>
<p><code>ComposeView</code> is an ordinary <code>Container</code>, so a Compose screen and a Codename One component share a form, a theme and an event thread.</p>
<h2>What's different on our side</h2>
<ul>
<li><strong>More targets.</strong> iOS, Android, the web, native macOS, Windows and Linux with no JVM, plus watchOS and tvOS. The Keynote benchmark itself hasn't been built for watchOS, tvOS, Windows or Linux yet.</li>
<li><strong>Java too.</strong> Your team can write Java and Kotlin in one project, and share code with a Java backend.</li>
<li><strong>Smaller.</strong> 16.8 MB of executable against 22.9 MB, or 8.9 MB if the screen is in Java.</li>
<li><strong>Build errors instead of surprises.</strong> A composable or modifier we haven't implemented fails the build with its original name and source line. It doesn't render wrong on a device.</li>
</ul>
<h2>What doesn't work yet</h2>
<p><code>LazyColumn(reverseLayout = true)</code> throws; it isn't implemented. <code>Box</code>, <code>Row</code> and <code>Column</code> aren't inline functions here, as they are upstream, because a public inline function can't call our internal layout code. The Compose runtime's inline functions are JVM 11 bytecode, so the build targets 11. On Gradle, the plugin refuses to build until <code>org.jetbrains.kotlin.plugin.compose</code> is applied, and it tells you the line to add.</p>
<h2>Try it</h2>
<p>The <a href="https://www.codenameone.com/developer-guide/kotlin-multiplatform-interop/">Kotlin Multiplatform chapter</a> covers the import, mixing Compose with Codename One components, and the benchmark. The Keynote source and its harness are in <code>scripts/kmp-bench</code> in the <a href="https://github.com/codenameone/CodenameOne">repository</a>. If you run KMP in production, I'd love to hear which composable you hit first that we don't have.</p>
<p>Tomorrow: <a href="https://www.codenameone.com/blog/swing-and-javafx-on-phones/">Your Swing and JavaFX Code on iPhone, Android and the Web</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Flutter Better in Java]]></title><description><![CDATA[Codename One now builds Flutter apps from their Dart source, and the result starts faster and uses less memory than Flutter's own release build on Android…]]></description><link>https://debugagent.com/flutter-better-in-java</link><guid isPermaLink="true">https://debugagent.com/flutter-better-in-java</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[opensource]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Fri, 06 Nov 2026 16:01:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/7599976a-c0df-4e07-83d3-77df74001607.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I usually blog about a feature the week it lands. This one landed a few weeks ago and was in development for months before that: Codename One can now take a Flutter app's Dart source and build it as a Codename One app. The results are amazing. I held this post back because I know how explosive these claims are. I wanted the numbers to come from a CI job that runs on every commit instead of a benchmark I tuned once on my laptop.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<p>In the meantime we also added support for Kotlin Multiplatform with Compose, for a big part of Swing and JavaFX, and for classic Android apps on iOS. More is coming. The part that still surprises me is how well Codename One does against the originals where we measured them. The same Flutter app, built from the same Dart files, starts faster, uses less memory and ships less code when Codename One builds it. That holds on Android, macOS, Windows and Linux, and the sizes hold on iOS and the web too.</p>
<h2>The same Dart, two builds</h2>
<p>This is the Flutter Gallery, the Flutter team's own showcase app. On the left it runs as Flutter built it. On the right, Codename One built it from the same Dart source, with no edits.</p>
<p><a href="https://www.codenameone.com/blog/release-2026-10-30/flutter-vs-codenameone.mp4">Download the side by side video</a>.</p>
<p>Look closely and you'll see it isn't pixel identical. In the Reply inbox the avatars are circles on the Flutter side and rounded squares on ours. Text wraps a few characters apart in places. The translation isn't perfect, and the <a href="https://www.codenameone.com/developer-guide/flutter-interop/">developer guide</a> says so up front: Dart support is experimental, some callbacks and parameters are accepted and then ignored, and so far we have verified it against one large app. If you bring a Flutter app over, test every interaction your screens depend on.</p>
<p>But the hard part works. Layout, navigation, theming, text input, lists and the Material and Cupertino widgets all render from the original source, and what you get is a real Codename One app, not a picture of one.</p>
<p>Bringing a project over is one command in a Codename One project:</p>
<pre><code class="language-bash">mvn cn1:import-flutter-project -Dcn1.flutter.import=/path/to/flutter_app
</code></pre>
<p>It copies <code>lib</code>, the assets and the fonts, adds the Flutter runtime to the build, writes the main class and tells you which of your pub dependencies are covered. You don't need the Dart or Flutter SDK to build the result. The transpiler is Java and runs inside the normal Maven build.</p>
<h2>Coming This Week</h2>
<p>Today is the Flutter story and the numbers behind it. Then one post a day:</p>
<ul>
<li><strong>Saturday, October 31:</strong> <a href="https://www.codenameone.com/blog/compose-on-more-screens/">Your Compose Code, on More Screens and Less CPU</a>. Kotlin Multiplatform and Compose, running on Codename One, and why the Java version of the same screen is faster still.</li>
<li><strong>Sunday, November 1:</strong> <a href="https://www.codenameone.com/blog/swing-and-javafx-on-phones/">Your Swing and JavaFX Code on iPhone, Android and the Web</a>. What carries over, what doesn't, and why you might not miss the parts that don't.</li>
<li><strong>Monday, November 2:</strong> <a href="https://www.codenameone.com/blog/bastion-hardened-bank-template/">Bastion: A Hardened Bank Template, and Crypto Wallets in Core</a>. A virtual bank and exchange with passkeys, signed requests and a double entry ledger, plus wallets for Ethereum, Bitcoin, and Solana.</li>
<li><strong>Tuesday, November 3:</strong> <a href="https://www.codenameone.com/blog/reel-streaming-and-courses-template/">Reel: Your Own Streaming Service or Course Platform</a>. Community uploads, courses, DRM and moderation in one Java project.</li>
<li><strong>Wednesday, November 4:</strong> <a href="https://www.codenameone.com/blog/android-apps-everywhere-even-without-google/">GrapheneOS, LineageOS, /e/OS and Others Are Now Officially Supported</a>. Room, WorkManager and document pickers in the Android layer, and apps that run on GrapheneOS as they are.</li>
<li><strong>Thursday, November 5:</strong> <a href="https://www.codenameone.com/blog/backend-caches-certificates-and-a-simulator-that-types/">Caches, Certificates, Streaming Uploads and a Simulator That Types</a>. Eight backend upgrades and a simulator with a virtual keyboard and video recording.</li>
</ul>
<p><a href="https://www.codenameone.com/blog/compose-on-more-screens/"><img src="https://www.codenameone.com/developer-guide/img/kmp-keynote-schedule.png" alt="A Compose schedule app rendered by Compose Multiplatform and by Codename One" width="1024" height="907" /></a></p>
<p>Compose, on Codename One.</p>
<p><a href="https://www.codenameone.com/blog/bastion-hardened-bank-template/"><img src="https://www.codenameone.com/developer-guide/img/bastion-security-center.png" alt="The Bastion Security Center screen" width="420" height="860" /></a></p>
<p>Bastion's Security Center.</p>
<p><a href="https://www.codenameone.com/blog/reel-streaming-and-courses-template/"><img src="https://www.codenameone.com/developer-guide/img/reel-viewer-home.png" alt="The Reel home screen" width="1080" height="1920" /></a></p>
<p>Reel's catalog.</p>
<p><a href="https://www.codenameone.com/blog/android-apps-everywhere-even-without-google/"><img src="https://www.codenameone.com/developer-guide/img/android-interop-material.png" alt="An Android Material screen rendered by Android and by Codename One" width="736" height="800" /></a></p>
<p>Android code, on every target.</p>
<h2>The numbers</h2>
<p>Every commit to Codename One builds the Flutter Gallery twice: once with Flutter's own release build and once with Codename One. CI measures both on the same machine in interleaved rounds, so a runner that slows down halfway through penalizes both builds equally. The figures below are from the run on October 29.</p>
<img src="https://www.codenameone.com/blog/release-2026-10-30/flutter-cold-start.svg" alt="Cold start to first frame. Android: 395 ms for Codename One against 1247 ms for Flutter. macOS: 609 against 722 ms. Windows: 126 against 205 ms. Linux: 123 against 198 ms." width="760" height="364" />

<img src="https://www.codenameone.com/blog/release-2026-10-30/flutter-memory.svg" alt="Memory at rest. Android: 46 MB for Codename One against 79 MB for Flutter. macOS: 37 against 56 MB. Windows: 58 against 92 MB. Linux: 82 against 224 MB." width="760" height="364" />

<img src="https://www.codenameone.com/blog/release-2026-10-30/flutter-code-size.svg" alt="Executable code. Android: 4.7 MB for Codename One against 20.6 MB for Flutter. iOS: 17.3 against 19.1 MB. macOS: 33.2 against 47.9 MB. Windows: 11.4 against 14.1 MB. Linux: 14.2 against 16.1 MB. Web: 12.9 against 25.2 MB." width="760" height="502" />

<p>CI collects 26 metrics: installed size, executable code and download size on six platforms, plus cold start and memory at rest on the four where we can measure both sides fairly. Codename One is ahead on all 26. The Android timings come from an emulator, and iOS start-up and memory aren't measured; both are explained below. The biggest gaps are on Android, where the app starts in a third of the time and carries a quarter of the code, and on Linux, where it settles at 82 MB against 224 MB.</p>
<p>The comparison is tilted toward Flutter, not away from it. The app is Flutter's own showcase, written by the Flutter team in Flutter's idioms, and Codename One runs it as it is. To do that, Codename One carries a runtime that reimplements Flutter's widget, element and layout model on top of Codename One components. That layer is slower than Codename One code written directly; the <a href="https://www.codenameone.com/blog/compose-on-more-screens/">Compose post</a> shows the same effect, where the imperative Java version of a screen does a third of the work of the declarative one. A Codename One app never pays for that layer. We win while paying for it.</p>
<p>CI also runs eleven compute workloads (hash maps, recursion, string building, sorting, arithmetic and more) in Java and in Dart. On every native platform we measured, Codename One is faster overall, by 1.3x on Android up to 1.9x on Windows and Linux:</p>
<img src="https://www.codenameone.com/blog/release-2026-10-30/flutter-compute.svg" alt="Compute speedups for eleven workloads on Android, macOS, Windows and Linux. Codename One is faster or tied in 38 of the 43 measured cells. Flutter wins object allocation on Android (2.3x) and macOS (3.1x), value escape on Android (1.2x), and quicksort on macOS and long arithmetic on Windows by 2% and 6%. Geometric means: Android 1.3x, macOS 1.5x, Windows 1.9x, Linux 1.9x for Codename One." width="760" height="574" />

<p>Flutter takes 5 of the 43 cells. Two are within 6%. The real one is object allocation on Android and macOS, where Dart's allocator is quick at short lived objects; that's on our list.</p>
<p>The web is the exception, and it's the one place Flutter is faster. We leave it out of the comparison because Flutter's web build gets some of the workloads wrong: integer arithmetic, random array access and quicksort return different checksums than the same code on every other platform, because Dart on the web runs numbers as JavaScript doubles. A benchmark that gets the answer wrong can't be timed against one that gets it right. On the workloads where both sides agree, Flutter is ahead. The browser is asynchronous by nature, and that's the one environment where Flutter's model helps it rather than costing it. The sizes still favor us there.</p>
<p>Some things aren't measured, and the charts leave them out rather than guess. Flutter can't compile Dart ahead of time for the iOS simulator, so iOS start-up and memory would compare Flutter's debug engine against our release build. We report iOS sizes only. Web start-up needs a browser driver the benchmark doesn't have yet. Android timings come from an emulator, so they compare two builds on one machine rather than predicting a phone. The method, the harness and the raw numbers are in the <a href="https://www.codenameone.com/developer-guide/flutter-interop/">Flutter chapter of the developer guide</a>, and the benchmark lives in <code>scripts/flutter-bench</code> in the <a href="https://github.com/codenameone/CodenameOne">repository</a>.</p>
<h2>How a compatibility layer can be faster than the original</h2>
<p>Each of these compatibility layers is a tool that runs at build time. None of them is a VM inside your app.</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBEW0ZsdXR0ZXIgLyBEYXJ0XSAtLT58dHJhbnNwaWxlZCB0byBKYXZhfCBKCiAgICBLW0tvdGxpbiBNdWx0aXBsYXRmb3JtIC8gQ29tcG9zZV0gLS0-fGtvdGxpbmMgKyBDb21wb3NlIFVJIGxheWVyfCBKCiAgICBTW1N3aW5nIC8gSmF2YUZYXSAtLT58Ynl0ZWNvZGUgcmVtYXBwZWR8IEoKICAgIEFbQW5kcm9pZCBhcHBdIC0tPnxyZXNvdXJjZXMgY29tcGlsZWQsIGJ5dGVjb2RlIHJlbWFwcGVkfCBKCiAgICBKW0phdmEgYnl0ZWNvZGUgKyBDb2RlbmFtZSBPbmUgY29yZV0gLS0-IFBbUGFycGFyVk0gLyBuYXRpdmUgcG9ydHNdCiAgICBQIC0tPiBJW2lPU10KICAgIFAgLS0-IE5bQW5kcm9pZF0KICAgIFAgLS0-IE1bbWFjT1MgLyBXaW5kb3dzIC8gTGludXhdCiAgICBQIC0tPiBXW1dlYl0KICAgIFAgLS0-IE9bd2F0Y2hPUyAvIHR2T1Nd?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<p>The Dart transpiler reads your widget source during <code>generate-sources</code> and writes Java. A runtime library then implements Flutter's layout and composition model (constraints down, sizes up, elements reconciled against widgets) on top of Codename One containers. It does not reimplement Flutter's rasterizer. Painting is ours. Compose works the same way: kotlinc compiles your Kotlin, the Compose runtime ships unmodified, and only the UI layer is ours. Swing, JavaFX and Android apps compile against their usual APIs, and a remap step points the bytecode at our implementations.</p>
<p>So the overhead is real, and it's added on top of Codename One. The reason the result still wins is what's underneath. ParparVM compiles Java ahead of time to C and then to a native binary, and its dead code elimination drops whatever your app doesn't reach. There's no Dart VM, no Skia or Impeller engine and no second runtime in the bundle. That's how the Android build ends up with 4.7 MB of executable code against 20.6 MB.</p>
<p>Here is the Dart that calls into the platform. It's ordinary Flutter code:</p>
<pre><code class="language-dart">final batteryChannel = MethodChannel('com.example.app/battery');

Future&lt;int&gt; getBatteryLevel() async {
  final level = await batteryChannel.invokeMethod('getBatteryLevel');
  return level as int;
}
</code></pre>
<p>And here is the other side of that channel, in plain Java, with no plugin and no per-platform Swift or Kotlin:</p>
<pre><code class="language-java">MethodChannel channel = new MethodChannel("com.example.app/battery");
channel.setMethodCallHandler(new MethodChannel.MethodCallHandler() {
    @Override
    public void onMethodCall(MethodCall call, MethodChannel.Result result) {
        if ("getBatteryLevel".equals(call.method())) {
            result.success(87);
        } else {
            result.notImplemented();
        }
    }
});
</code></pre>
<p>You don't have to move the whole app either. <code>FlutterUI.wrap()</code> returns an ordinary <code>Container</code>, so a Dart screen can sit inside a Codename One form next to components you wrote in Java:</p>
<pre><code class="language-java">Form dashboard = new Form("Dashboard", BoxLayout.y());
dashboard.add(new Label("Written in Codename One"));
dashboard.add(FlutterUI.wrap(new Text("Rendered from Dart")));
dashboard.add(new Button("Also Codename One"));
dashboard.show();
</code></pre>
<h2>Similar in spirit</h2>
<p>Flutter and Codename One made the same bet. Neither wraps the platform's widgets. Both draw every component themselves on a lightweight surface, so you control every pixel and the behavior doesn't drift between platforms. Codename One still ships native themes, so an app can look like iOS on an iPhone and like Material on Android, or look like your brand everywhere. That shared architecture is why a Flutter widget tree maps onto Codename One so naturally. The differences are in what sits around that core: the threading model, how apps are built and how features ship.</p>
<h2>Can't Flutter do the same?</h2>
<p>No. Flutter could, in theory, run a Codename One app the way we run a Flutter app. It would be slow, because the two models point in opposite directions.</p>
<p>Flutter is asynchronous to the core. Dart runs in an event loop, platform calls are messages that come back as futures, and the engine draws on its own threads. Codename One is synchronous: your code calls the platform and gets an answer. Emulating a synchronous API on top of an asynchronous one means queuing, waiting and copying on every call. Going the other way is cheap: a future is a callback, and a callback is a method call.</p>
<p>The same reason explains why Flutter can't catch Codename One on most platforms. Operating systems, graphics APIs and hardware are synchronous. Codename One calls them directly. Flutter goes through a message channel and its own engine to reach them.</p>
<p>Android makes it obvious. The native platform on Android is Java. Codename One compiles to it and talks to Android the way Android expects. Flutter avoids it, shipping its own VM and engine beside the one the phone already has. That's why Android shows the biggest gap: a third of the start-up time and a quarter of the code.</p>
<h2>Two differences you feel every day</h2>
<p>The threading model shows up in the benchmarks. These two don't, but you notice them every day you work.</p>
<h3>Builders</h3>
<p>A Codename One app is a Java project. The build of a native app happens in a builder: our cloud build servers or a local build, which take your compiled code and produce the iOS, Android or desktop binary. That moves the hard part of the developer experience into our hands:</p>
<ul>
<li><strong>Build iOS apps from Windows or Linux.</strong> The cloud builder holds the Mac, Xcode and the signing steps. You don't need to own a Mac to ship to the App Store.</li>
<li><strong>Cheap CI.</strong> Your unit and UI tests run in Java, in the simulator, on any CI runner. No emulator to boot and no macOS runner to pay for on every commit.</li>
<li><strong>New features without migration work.</strong> When Apple or Google change a requirement, or we add a capability, we update the builder. Your project picks it up on the next build, with nothing to upgrade or reconfigure.</li>
</ul>
<h3>Everything in one place</h3>
<p>Codename One used to aim for a modular core, with features broken out into cn1libs. Flutter is going through that phase now, moving pieces such as its Material and Cupertino themes out of the framework into independent packages. We went the opposite way. The Codename One core now covers what Flutter does, plus most of what people reach for in Flutter's most popular packages, and this week's posts add more.</p>
<p>A bigger core costs you nothing, because you don't pay for what you don't use, and that works on two levels. ParparVM drops every class your app doesn't reach. The builder goes further: it looks at what your compiled code calls and adds a native library only when a feature needs it. This week's crypto support is a good example. Its native kernels for secp256k1, Ed25519 and the hashes are what make it fast, and an app that never touches the crypto API shouldn't carry them. It doesn't. Call a wallet or a signature API and the builder links them in, and you get native speed that our CI measures against the reference libraries, libsecp256k1 and OpenSSL among them. That's how the builds above stay smaller than Flutter's. What you get instead:</p>
<ul>
<li><strong>One version.</strong> No matrix of package versions to keep compatible, and no upgrade that breaks because two packages disagree.</li>
<li><strong>Nothing abandoned.</strong> No package your app depends on that its author stopped maintaining two years ago.</li>
<li><strong>A short supply chain.</strong> This is the big one. Every package in a dependency tree is a person you trust with your users' devices. A maintainer who burns out, sells the package, gets angry or gets hacked can push code into your app on the next update, and attacks on open source packages have done exactly that. With the features in core, your app's dependencies are one project with one review process, not a tree of packages from strangers. That fits the rest of this week: the <a href="https://www.codenameone.com/blog/bastion-hardened-bank-template/">Bastion</a> template is a hardened bank because security is something we take seriously, and banks and other regulated organizations build on Codename One. For them, a short supply chain is a requirement.</li>
<li><strong>Everything moves together.</strong> When we fix rendering, add a platform or change the build, every feature comes along, including the niche ones.</li>
<li><strong>One source of truth.</strong> The developer guide documents all of it, and when something breaks there is one team responsible for the answer.</li>
</ul>
<h2>We can finally show the code</h2>
<p>For years, every Codename One against Flutter discussion went the same way. I'd explain why ahead of time compiled Java with a lightweight UI should produce a smaller, faster app. Someone would explain why it shouldn't. Neither of us had the same app built both ways, so it came down to which camp you were already in.</p>
<p>Now there's one app, built both ways, measured on every commit. If you think a number is wrong, the harness is in the repository and you can rerun it.</p>
<p>The part I didn't expect is how much this made Codename One better. Each compatibility layer exposed problems we had missed for years:</p>
<ul>
<li><strong>Styles were parsed over and over.</strong> Every component re-parsed its pressed and disabled styles from the theme. Caching them took component creation in the Gallery from 131 ms to 17 ms and resident memory from 247 MB to 144 MB.</li>
<li><strong>Every string constant was created at startup.</strong> ParparVM materialized every string literal before <code>main()</code> ran. Making the pool lazy cut that step from 119 ms to 46 ms.</li>
<li><strong>Rounded images were copied.</strong> Rounding an image's corners built a second bitmap, 32 times during the first frame. Doing it in the fragment shader removed the copies and stopped memory from swinging between runs.</li>
<li><strong>Images decoded inside the first frame.</strong> Deferring that decode took the first frame from 302 ms to 213 ms.</li>
<li><strong>An idle app burned CPU.</strong> The Compose work found, and we fixed, a bug where on phones with a notch, safe area padding kept queuing layout so an idle app sat at 14% to 26% CPU.</li>
</ul>
<p>None of these fixes are specific to Flutter. If you write Codename One apps in plain Java and never touch a Dart file, your app gets these fixes too: faster start-up, lower memory and an idle CPU that stays idle.</p>
<h2>More This Week</h2>
<h3>Your Compose code, on more screens</h3>
<p>Kotlin Multiplatform is a good platform, and Compose Multiplatform is well built. Codename One now runs the same Compose code on more targets, used about a quarter of the CPU per frame on our benchmark screen, and lets you drop to Java where it counts.</p>
<figure><a href="https://www.codenameone.com/developer-guide/img/kmp-keynote-schedule.png"><img width="1024" height="907" src="https://www.codenameone.com/developer-guide/img/kmp-keynote-schedule.png" alt="The same Compose schedule screen rendered by Compose Multiplatform and by Codename One" /></a><figcaption>The same Compose screen: Compose Multiplatform on the left, Codename One on the right.</figcaption></figure>

<pre><code class="language-kotlin">class MyApp : Lifecycle() {
    override fun runApp() {
        ComposeForm { LayoutScreen() }.show()
    }
}
</code></pre>
<p>Saturday's <a href="https://www.codenameone.com/blog/compose-on-more-screens/">Compose article</a> has the numbers and their caveats.</p>
<h3>Swing and JavaFX on phones</h3>
<p>A large share of real Swing and JavaFX code now builds for iOS, Android and the web: the samples we test include SwingSet2 and Notepad, the JDK's own demos. On Linux the native build is 4 to 6 times smaller zipped than the same app on the JVM, and starts faster in all 8 apps, even against a JVM tuned with AppCDS.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/desktop-compat-swingset2.png"><img src="https://www.codenameone.com/developer-guide/img/desktop-compat-swingset2.png" alt="SwingSet2, the JDK Swing demo, running as a Codename One app on an iPad" width="918" height="1300" /></a></p>
<p>SwingSet2, the JDK demo, on an iPad.</p>
<p><a href="https://www.codenameone.com/developer-guide/img/desktop-compat-fx2048.png"><img src="https://www.codenameone.com/developer-guide/img/desktop-compat-fx2048.png" alt="The open source JavaFX 2048 game running as a Codename One app on an Android phone" width="642" height="1300" /></a></p>
<p>The JavaFX 2048 game on a phone.</p>
<img src="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-swing-controls.png" alt="Swing controls running on an iPhone" width="589" height="1278" />

<p>Swing controls.</p>
<img src="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-swing-tables.png" alt="A JTable running on an iPhone" width="589" height="1278" />

<p>JTable.</p>
<img src="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-javafx-controls.png" alt="JavaFX controls running on an iPhone" width="589" height="1278" />

<p>JavaFX.</p>
<img src="https://www.codenameone.com/developer-guide/img/desktop-compat-ios-javafx-fxml.png" alt="An FXML form running on an iPhone" width="589" height="1278" />

<p>FXML and CSS.</p>
<p>Sunday's <a href="https://www.codenameone.com/blog/swing-and-javafx-on-phones/">Swing and JavaFX article</a> goes through what carries over and why you won't miss what doesn't.</p>
<h3>A bank you can study, and wallets in core</h3>
<p>A large share of our users are banks and financial institutions. <strong>Bastion</strong> is a reference implementation for them: a virtual bank and small exchange with passkeys, TOTP, signed requests, device keys, a hash chained audit log, a double entry ledger and an auditor console. Codename One also gained wallet APIs for Ethereum, Bitcoin, and Solana.</p>
<img src="https://www.codenameone.com/developer-guide/img/bastion-dashboard.png" alt="The Bastion dashboard" width="420" height="860" />

<p>Four currencies.</p>
<img src="https://www.codenameone.com/developer-guide/img/bastion-order-book.png" alt="The BTC/USD market with candles and the order book" width="420" height="860" />

<p>The BTC/USD market.</p>
<img src="https://www.codenameone.com/developer-guide/img/bastion-security-center.png" alt="The Bastion Security Center" width="420" height="860" />

<p>The Security Center.</p>
<pre><code class="language-java">Wallet wallet = Wallet.fromMnemonic(words, "");
EvmAddress eth = wallet.getEvmAddress(0, 0);
BitcoinAddress btc = wallet.getBitcoinAddress(BitcoinNetwork.MAINNET, Wallet.BIP84, 0, 0, 0);
SolanaAddress sol = wallet.getSolanaAddress(0);
</code></pre>
<p>Monday's <a href="https://www.codenameone.com/blog/bastion-hardened-bank-template/">Bastion article</a> covers the hardening, one layer at a time.</p>
<h3>Streaming and courses</h3>
<p><strong>Reel</strong> is a streaming service and its server in one Java project. Switch a preset and it becomes a subscription service, a creator platform in the style of YouTube, or an academy with courses, lessons, and quizzes.</p>
<img src="https://www.codenameone.com/developer-guide/img/reel-viewer-home.png" alt="The Reel catalog" width="1080" height="1920" />

<p>The catalog.</p>
<img src="https://www.codenameone.com/developer-guide/img/reel-viewer-player-tracks.png" alt="The Reel player" width="1080" height="1920" />

<p>The player.</p>
<img src="https://www.codenameone.com/developer-guide/img/reel-viewer-course.png" alt="A Reel course" width="1080" height="1920" />

<p>A course.</p>
<pre><code class="language-java">StreamRequest req = new StreamRequest(manifestUrl)
        .setDrm(new DrmConfig(DrmScheme.WIDEVINE, licenseUrl));
</code></pre>
<p>Tuesday's <a href="https://www.codenameone.com/blog/reel-streaming-and-courses-template/">Reel article</a> walks through uploads, moderation, and DRM.</p>
<h3>Android code everywhere, including GrapheneOS</h3>
<p>The Android compatibility layer now covers Room, WorkManager, location, sensors, foreground services and the document picker intents, all running on iOS too. And GrapheneOS, LineageOS, CalyxOS and /e/OS are now officially supported, with a boundary CI verifies: one APK checks for Play Services at run time, and push works through UnifiedPush.</p>
<img src="https://www.codenameone.com/developer-guide/img/android-interop-material.png" alt="A Material 3 screen on Android and on Codename One" width="736" height="800" />

<p>Material 3, Android left, Codename One right.</p>
<img src="https://www.codenameone.com/developer-guide/img/android-interop-recycler.png" alt="A RecyclerView on Android and on Codename One" width="736" height="800" />

<p>RecyclerView, same source.</p>
<p>Wednesday's <a href="https://www.codenameone.com/blog/android-apps-everywhere-even-without-google/">Android article</a> has the details.</p>
<h3>A modern backend, and a simulator that types</h3>
<p>The simulated keyboard sliding up over a sign up form.</p>
<p>Thursday closes the week with eight backend upgrades (a bounded cache, outbound OAuth tokens, PKI, JSON codecs, streaming uploads, error advice, <code>java.time</code> in the ORM and test slices) and a simulator that slides up a virtual keyboard and records video. See the <a href="https://www.codenameone.com/blog/backend-caches-certificates-and-a-simulator-that-types/">backend and simulator article</a>.</p>
<h2>The universal platform</h2>
<p>Last week I made the case that <a href="https://www.codenameone.com/blog/rewrite-everything-in-java-not-rust/">a Java word processor beats its Rust twin</a>. This week the swing is bigger. Flutter, Compose, Swing, JavaFX and Android code all build into the same kind of app and run on iOS, Android, desktop, the web and the watch.</p>
<p>Instead of coding to an operating system, you code to Codename One, and Codename One becomes the operating system. The usual price for that kind of abstraction is performance. We don't charge it. You get more performance, more features, more compatibility and more platforms, and it's free and open source.</p>
<p>If you have a Flutter app, run the import on a copy and build it for the simulator. Tell us which screen breaks first; that's the most useful bug report we can get right now. If you're on Kotlin, Swing, JavaFX or Android, the rest of this week is for you. And if you think a number above is wrong, the benchmark is in the repository. Rerun it and open an issue.</p>
]]></content:encoded></item><item><title><![CDATA[WebRTC Calls, Key Agreement and ORM Checks at Build Time]]></title><description><![CDATA[Codename One adds WebRTC voice and video calls, key agreement and HKDF on every platform, a backend WebClient with mutual TLS and HTTP/2, and ORM mapping…]]></description><link>https://debugagent.com/webrtc-calls-key-agreement-and-orm-checks-at-build-time</link><guid isPermaLink="true">https://debugagent.com/webrtc-calls-key-agreement-and-orm-checks-at-build-time</guid><category><![CDATA[Java]]></category><category><![CDATA[Mobile Development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Android]]></category><category><![CDATA[opensource]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Shai Almog]]></dc:creator><pubDate>Thu, 05 Nov 2026 01:01:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5762357f734d6d686c0f568a/c61f8d57-5c25-4401-ac10-66dcf4a8c138.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The last post this week covers what <a href="https://www.codenameone.com/blog/launch-your-own-private-messenger/">Parley</a>, <a href="https://www.codenameone.com/blog/launch-your-own-food-delivery-app/">Savor</a> and <a href="https://www.codenameone.com/blog/create-an-uber-clone-in-1-minute/">Wayline</a> needed underneath: calls, encryption and a backend you can trust with real data. These are features you'd usually assemble from three vendors and a few weekends of glue code.</p>
<aside><strong>What is Codename One?</strong> 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 <a href="https://www.codenameone.com/">codenameone.com</a>.</aside>

<h2>Voice and video calls with WebRTC</h2>
<p><code>com.codename1.webrtc</code> carries live audio and video directly between two devices, encrypted on the way, with a TURN relay when there's no direct path. On Android it's Google's WebRTC library, on iOS the Apple build of the same library, and in the browser it's the browser's own WebRTC. Referencing the package is what adds the native library to a build, so apps that don't make calls don't pay for it.</p>
<pre><code class="language-java">WebRtc.openUserMedia(true, true, true).ready(media -&gt; {
    PeerConnectionConfig config = new PeerConnectionConfig()
            .addIceServer(IceServer.stun("stun:stun.example.com:3478"));
    pc = WebRtc.createPeerConnection(config, new PeerConnection.Listener() {
        public void iceCandidate(PeerConnection connection, IceCandidate candidate) {
            signalling.send(candidate);
        }

        public void stateChanged(PeerConnection connection, String state) {
        }

        public void remoteTrack(PeerConnection connection, MediaTrack track) {
            if (track.isVideo()) {
                form.add(BorderLayout.CENTER, new VideoView(track, false));
                form.revalidate();
            }
        }
    });
    pc.addTrack(media.getAudio());
    pc.addTrack(media.getVideo());
    pc.createOffer().ready(offer -&gt; pc.setLocalDescription(offer)
            .ready(done -&gt; signalling.send(offer)));
});
</code></pre>
<p>Signaling is yours on purpose. The package creates the offer, the answer and the candidates, and you send them over whatever you already have: a WebSocket, your server, a push. So the same call code works with a Codename One backend or with anything else. Parley sends them over its live channel, and the media never touches its server.</p>
<img src="https://mermaid.ink/img/c2VxdWVuY2VEaWFncmFtCiAgICBwYXJ0aWNpcGFudCBBIGFzIENhbGxlcgogICAgcGFydGljaXBhbnQgUyBhcyBZb3VyIHNlcnZlcgogICAgcGFydGljaXBhbnQgQiBhcyBDYWxsZWUKICAgIEEtPj5TOiBPZmZlciBhbmQgY2FuZGlkYXRlcwogICAgUy0-PkI6IE9mZmVyIGFuZCBjYW5kaWRhdGVzCiAgICBCLT4-UzogQW5zd2VyIGFuZCBjYW5kaWRhdGVzCiAgICBTLT4-QTogQW5zd2VyIGFuZCBjYW5kaWRhdGVzCiAgICBBLS0-PkI6IEVuY3J5cHRlZCBhdWRpbyBhbmQgdmlkZW8sIHBlZXIgdG8gcGVlcg==?type=png&amp;bgColor=ffffff" alt="Diagram" style="display:block;margin:0 auto" />

<h2>Key agreement and HKDF everywhere</h2>
<p>End-to-end encryption needs two parties that have never met to agree on a key over a channel anyone can read. Codename One now does that on every port and on the backend. <code>KeyGenerator.ec(256)</code> makes a P-256 key pair, <code>KeyAgreement.ecdh</code> combines your private key with the other side's public key, and <code>Hkdf</code> turns the shared secret into a proper key:</p>
<pre><code class="language-java">byte[] shared = KeyAgreement.ecdh(mine.getPrivateKey(), theirs.getPublicKey());

// The shared secret is not a key yet. HKDF turns it into one, and the info
// label keeps keys derived for different purposes apart.
byte[] info = "chat message key v1".getBytes();
byte[] key = Hkdf.derive("SHA-256", null, shared, info, 32);

byte[] nonce = SecureRandom.bytes(12);
byte[] sealed = Cipher.aesEncrypt(Cipher.AES_GCM, new SecretKey("AES", key),
        nonce, null, message);
</code></pre>
<p>The key agreement runs in the platform's native crypto provider. <code>Hkdf</code> is portable Java over <code>Hmac</code>, so it gives the same bytes on every device and on your server. These are the building blocks of Parley's X3DH and Double Ratchet, and they're just as useful for encrypted backups, secure pairing or signing data between your app and your server.</p>
<h2>A backend client for serious integrations</h2>
<p>Real backends call other services: a payment processor, a bank, a partner API. Many of those authenticate callers with a client certificate. The backend's <code>WebClient</code> handles that, along with HTTP/2, timeouts and connection pooling:</p>
<pre><code class="language-java">this.partner = new WebClient()
        .setClientCertificate(ClientCertificate.pkcs12(archive, password))
        .setRequireHttp2(true)
        .setRequestTimeoutMillis(10000);
</code></pre>
<p>Server certificates and host names are always verified, and there is no option to turn that off. Two clients never share a connection, so a connection authenticated with one certificate is never used for a request made with another.</p>
<h2>ORM mistakes fail the build</h2>
<p>This is my favorite one. With Hibernate and Spring, plenty of mapping mistakes compile fine and only blow up when the application starts, or worse, on the first request that touches the broken entity. You find out in staging if you're lucky.</p>
<p>Codename One's ORM reads your entities when you compile, so those mistakes are build errors that name the class and the field:</p>
<pre><code class="language-plaintext">@Temporal requires a java.util.Date field: signedUp
Persistent fields must be writable: name
@Entity class com.example.Customer must declare a public no-arg constructor
@Version requires an int or long field: revision
</code></pre>
<p>Repositories get the same treatment: an unsupported method signature, a derived query that names a field the entity doesn't have, or a missing parameter name stops the build and names the repository and the method.</p>
<p>The same release makes it easier to put the ORM on a database you already have. Columns keep their names, native <code>TIMESTAMP</code> and <code>DATE</code> columns map to <code>java.util.Date</code> with <code>@Temporal</code>, and lifecycle callbacks can stay private:</p>
<pre><code class="language-java">@Entity(table = "legacy_customer")
public class LegacyCustomer {
    @Id @Column(name = "customer_no")
    private long id;

    @Column(name = "full_name", nullable = false)
    private String name;

    @Temporal(TemporalType.TIMESTAMP) @Column(name = "signed_up")
    private Date signedUp;

    @PrePersist
    private void defaults() {
        if (signedUp == null) {
            signedUp = new Date();
        }
    }
}
</code></pre>
<p>Before you deploy, <code>session.schemaReport()</code> compares the mappings with the real tables and tells you what's missing, without changing anything in the database.</p>
<h2>That's the week</h2>
<p>Three new apps you can launch, a word processor that holds up against Rust, and a stack of features that make the next app easier. Everything is in the <a href="https://github.com/codenameone/CodenameOne">repository</a>, and the guides for <a href="https://www.codenameone.com/developer-guide/webrtc/">WebRTC</a>, <a href="https://www.codenameone.com/developer-guide/security/">security</a>, <a href="https://www.codenameone.com/developer-guide/backend-web/">backend web</a> and the <a href="https://www.codenameone.com/developer-guide/annotation-sqlite-orm/">ORM</a> have the details. If you build something with these, I want to see it.</p>
]]></content:encoded></item></channel></rss>