proomt

Search

Search posts, papers, and topics

All posts

CodeName OneShai Almog7 min readintermediate

Native Drag and Drop Meets Cross-Device Continuity

Summary

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…

  • Continuity: implement StateProvider to serialize minimal app state (e.g., draft text) and call Continuity.checkpoint() after edits; restore with Continuity.restore() after auth; can use Apple Handoff, iCloud KV, or a cu…
  • Native drag‑and‑drop: create a NativeDragOperation (e.g., file list) and set a drop target with accepted MIME types; data can be supplied lazily via ClipboardContent.setDataProvider, but providers may run at drag start…
  • Threading: native drop callbacks run on the platform drag thread; Codename One marshals to the EDT; avoid blocking the drag thread.
  • Lifecycle: disable auto‑restore if you need user confirmation, clear state on logout, and set max age to avoid stale checkpoints.

These APIs let developers preserve user work across devices and let users move data between apps without copy‑paste, reducing friction in mobile‑first workflows. The design balances privacy (small, non‑credential payloads) with flexibility (custom relay), and the drag‑and‑drop implementation reuses…

6/10

Related reading

  1. 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
  2. VoIP, VPN, and the Build System Behind Them

    Codename One’s new builder pipeline can automatically generate the native plumbing required for VoIP call integration, managed VPN profiles, and packet‑tunnel extensions on iOS and Android. By inspecting which Java packages an app imports, the builder adds the necessary frameworks, entitlements, services, and even a separate signed Network Extension for iOS, letting developers keep their signalin…

    CodeName Onecodenameone.com10 min
  3. Tapjacking Protection: Rejecting Android Touches Behind an Overlay

    Codename One adds tapjacking protection to its Android runtime. It detects fully or partially obscured MotionEvents, offers four policies (OFF, REPORT, BLOCK, STRICT), can block the entire gesture, and on Android 12+ can request the system hide overlay windows. The API is exposed via `DeviceIntegrity.setTapjackingProtection` and a listener for state changes. iOS has no overlay threat, so the feat…

    CodeName Onecodenameone.com3 min
  4. Watch Apps: One Codebase, Two Real Applications

    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.

    CodeName Onecodenameone.com4 min
  5. A Mac App, Not an iOS App on a Mac

    Codename One switched its default Mac build from iOS‑Catalyst to a native AppKit port. The new path creates true NSApplication/NSWindow objects with per‑window CAMetalLayer rendering, native menus, text input, multi‑monitor support and accessibility, eliminating the costly image‑copy pipeline of Catalyst and enabling proper desktop window behavior.

    CodeName Onecodenameone.com3 min