proomt

Search

Search posts, papers, and topics

All posts

CodeName OneShai Almog4 min readintermediate

Watch Apps: One Codebase, Two Real Applications

Summary

Codename One now lets you build an Apple Watch or Wear OS companion app from a single codebase by specifying a watchMain class and optional watchStandalone flag. The new WearableConnection API offers putData, sendMessage, and transferFile primitives for asynchronous phone‑watch communication, with simulator support for both platforms.

  • Set codename1.watchMain to the watch entry class; use codename1.watchStandalone=true to produce a standalone Wear OS APK.
  • Use WearableConnection.putData for convergent state, sendMessage for immediate request/reply with replyFailed handling, and transferFile for large payloads.
  • Phone and watch share Java source, resources, CSS, and themes but have independent Storage, Preferences, and SQLite files.
  • Simulator launches both processes; CN.isWatch() and the watch theme let you adapt UI without code duplication.

Mobile developers building cross‑platform apps can reuse a single codebase for phone and watch companions while handling asynchronous communication reliably.

6/10

Related reading

  1. Watch Follow-Through: Complications, Tiles, and a Companion Wear APK

    Codename One 6.5 adds full watch‑face support: surface declarations now generate Apple Watch WidgetKit extensions and Wear OS complication data sources plus ProtoLayout Tiles. A phone‑side `Surfaces.publish()` mirrors descriptors to the watch via WatchConnectivity/Data Layer. Android builds now emit both a phone APK and a Wear‑only APK (or a standalone watch APK). WatchOS build failures were fixe…

    CodeName Onecodenameone.com5 min
  2. One App, More Than One Native Window

    Codename One now supports true native desktop windows via a new `Window` class that separates per‑surface state (paint queue, input routing, native peers) from the global `Display`. The change adds a `PaintSurface` abstraction, platform‑specific window back‑ends (AWT/Swing, Direct2D, GTK, UIWindowScene), and a migration path for components that assumed a single `Form`. Initial release has some UI…

    CodeName Onecodenameone.com11 min
  3. Native Drag and Drop Meets Cross-Device Continuity

    Codename One 8.0 adds two user‑experience primitives: **Cross‑Device Continuity** (state checkpointing + Apple Handoff + custom HTTP relay) and **Native Drag‑and‑Drop** (OS‑level drag using the same ClipboardContent model). The post shows the API (StateProvider, Continuity.checkpoint, NativeDragOperation), platform support tables, and practical advice on payload size, security, thread handling, a…

    CodeName Onecodenameone.com7 min
  4. Rootless Jailbreak Detection: Updating the Signals, Not the Claim

    The blog explains how Codename One updated its iOS jailbreak detector to handle modern rootless jailbreaks (e.g., palera1n, Dopamine). It replaces old file‑system probes with lstat checks, mount scans, and dual‑opinion API calls (libc vs raw syscall) to spot hidden bootstraps and instrumentation. It also reorders package‑manager URL‑scheme probes to prioritize Sileo, adds a background‑resume gate…

    CodeName Onecodenameone.com5 min
  5. App Intents: One Java Declaration for Siri, Spotlight, and Shortcuts

    Codename One adds @AppIntent annotations that let a static Java method be exposed as a Siri, Spotlight, or Android shortcut. The build‑time processor generates native declarations, a reflection‑free dispatch table, and validates the intent metadata. Handlers can be headless, accept typed parameters, return results, and be invoked internally via Intents.invoke(). Entities enable system‑driven disa…

    CodeName Onecodenameone.com5 min