proomt

Search

Search posts, papers, and topics

All posts

CodeName OneShai Almog5 min readintermediate

One Java API for HomeKit, Matter, and Google Home

Summary

Codename One adds a portable Java API that abstracts HomeKit, Matter, and Google Home into a unified trait‑based model. The library handles platform differences, partial read/write results, and OS‑driven commissioning.

  • The com.codename1.home package models accessories, services, and traits (e.g., ON_OFF, BRIGHTNESS) that map to HomeKit characteristics, Matter clusters, or Google Home APIs.
  • HomeAvailability enum provides granular states (PROVIDER_NOT_INSTALLED, PERMISSION_REQUIRED, COMMISSIONING_ONLY, etc.) instead of a simple null check.
  • Batch read/write operations return a TraitReading per trait, which can succeed, fail, or be unavailable, enabling graceful handling of partial failures.
  • TraitSubscription.isPushDelivery() indicates push vs poll models; drainChanges() coalesces updates when the app returns to foreground.

Java developers building cross‑platform smart‑home apps can avoid platform‑specific code and handle edge cases with a single, well‑defined API.

6/10

Related reading

  1. One Java Model from the App to PostgreSQL

    Codename One introduces a backend runtime allowing a single Java model to define entities and validation rules for both client applications and the server. This approach aims to reduce duplication and ensure consistent data rules from the app to PostgreSQL.

    CodeName Onecodenameone.com7 min
  2. 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
  3. 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
  4. Put App Documents in the System File Browser

    Codename One adds a read‑only DocumentProvider API that lets apps publish a virtual file tree to iOS Files and Android’s storage picker. The tree is defined with `DocumentNode` objects, can include remote‑only entries, and is shared via an App Group container. The iOS extension runs in a separate process, so the model is serialized and read independently; Android uses the same model inside the ap…

    CodeName Onecodenameone.com4 min