Device discovery enables finding nearby devices and engage in peer-to-peer communication using secure authentication and end-to-end encryption for bi-directional data sharing. A controlling device can also launch the same app on a target device, which is key to task handoff, where you start a task on a device and continue it on another. According to Google, the new capabilities can be used to create multiplayer games, to carry through productivity tasks across different devices, or to enable group experience, like group food ordering.
Google has announced a developer preview of its new Cross device SDK for Android, aimed to help developers build cross-device experiences using high-level, intuitive APIs. This SDK abstracts away the intricacies involved with working with device discovery, authentication, and connection protocols, allowing you to focus on what matters most—building delightful user experiences and connecting these experiences across a variety of form factors and platforms.
The new Cross device SDK provides a higher-level API on top of a number of distinct lower-level APIs, including Bluetooth, Wi-Fi, and Ultra-wide band. Apps using the cross-device SDKs don’t need to request permission to use the underlying services, making it easier and more transparent for both developers and users. Instead, users authorize their use when they allow apps to communicate with specific devices. On the receiving device, override her two methods onCreate and onNewIntent to handle activity creation when the user accepts the request.
For example, you can establish a secure connection to exchange data between devices. The Sessions API leverages both the Discovery and Secure Connect APIs to provide an overview of sessions that can be created on the originating device and sent or shared to other capable devices. To help developers adopt the new SDK, we created a rock-paper-scissors app that demonstrates how to use device discovery, secure connections, and session transfer and sharing. Another starting point for interested developers is the Google I/O `22 multi-device development ses