URC HTTP Target Kit for Android
Overview
The URC HTTP Target Kit for Android is a software development kit that lets Android application developers expose their applications and background services as URC-controllable targets. A target, in URC terminology, is any device or service whose functionality is described by a User Interface Socket Description and made available to remote controllers through the URC-HTTP protocol. Before this kit, exposing an Android application as a URC target required substantial protocol-level work on the developer’s part. The kit reduces that work to a small number of annotations and a generated socket description.
The kit is the Android counterpart of the platform-independent target libraries that the openURC ecosystem provides for Java SE and .NET. It implements the same URC-HTTP request and response handling as the desktop libraries but is packaged for the Android build system, uses Android’s embedded HTTP server infrastructure, and respects the Android lifecycle for foreground and background services.
Architecture
An Android application that uses the kit declares a target class, annotates the methods it wants to expose as URC commands, and registers the target with the kit at application startup. The kit then starts an embedded HTTP server inside the application process, advertises the target on the local network using the standard URC discovery mechanism, and routes incoming URC-HTTP requests to the appropriate Java methods on the registered target object. The application code does not have to handle protocol parsing, content negotiation, or session management; the kit takes care of all of these and exposes a clean Java method-call interface to the application developer.
The kit also generates a User Interface Socket Description from the Java type signatures of the annotated methods. This generated description is published through the kit’s embedded resource server endpoint and is what URC controllers retrieve when they discover the target. Developers can override the generated description with a hand-written one if the type signatures do not capture the full semantics of the exposed operation.
Lifecycle Integration
Android applications go through a more complex lifecycle than desktop applications, with foreground and background states, system-initiated suspends, and process restarts on resource pressure. The kit integrates with the Android Service mechanism so that a URC target can survive the suspension of its host activity. A URC target hosted in an Android Service continues to respond to controller requests as long as the service is running, and the kit re-publishes the target’s discovery record when the service restarts after a system-initiated kill.
Battery and network considerations have driven several optimisations in the kit. The embedded HTTP server uses non-blocking I/O to minimise thread overhead, and the discovery announcements are throttled to avoid wakeup storms on devices that are otherwise idle. These choices are documented in the developer guide and can be tuned for deployments with different trade-offs between responsiveness and battery life.
Use Cases
The kit was originally developed to support smart home and assisted living scenarios where an Android tablet hosts a service that controls one or more physical devices in the user’s environment. Typical examples include a media playback service that exposes the tablet’s music library to URC controllers elsewhere in the home, a notification service that lets a URC controller display alerts on the tablet’s screen, and a sensor service that publishes readings from the tablet’s built-in accelerometer or microphone for use in environment-aware applications.
Beyond home automation, the kit has been used in research deployments at academic partners of the openURC Alliance, where it served as the Android-side glue for experiments in cross-device user interface adaptation. The flexibility of the URC framework, combined with the wide installed base of Android devices, made the kit a convenient way to give researchers access to a large pool of potential URC targets without requiring custom hardware.
Source Code and Documentation
The source code for the URC HTTP Target Kit for Android is hosted in the openURC SourceForge repository together with the rest of the URC software ecosystem. The repository includes the kit itself, a sample Android application that demonstrates the annotation-based development model, and a developer guide that walks through the steps required to expose a new target. The kit is released under an open-source license to encourage adoption and experimentation by the developer community.