How Do You Build Powerful, Multi-Device Experiences for Android Users?

Photo of Mariusz Karwowski

Mariusz Karwowski

Updated Aug 2, 2023 • 6 min read
multi_device_experience_android_users

For a long time, replacing your old device was accompanied by the burden of logging back into all the applications. The only thing available to help users was the auto-downloading of previously installed apps.

With the release of Android Marshmallow (6.0) in 2015, Google introduced Auto Backup. This functionality automatically backs up a user’s data to the cloud, with a limitation of 25 MB for each application. It can back up all kinds of data, including everything that is stored in the application’s internal storage folder, and also shared preferences. However, all Auto Backup does is allow you to quickly set up a new device with your current account.

Let’s see what other Google API integration options are currently available for multi-device experiences and what is waiting around the corner.

Block Store API

Previously, when the users installed the same application or moved from one device to another, they had to count on the automated system that backed up the data.

However, since the Android 9 release, users’ credentials/access tokens can be restored via the Play Store by using the Block Store API. If the previous device is running on Android 6 or later, developers can skip the signing-in flow by manually uploading the access token to the Play Store via the Block Store API.

After that, we can count on user verification by Google when the device first launches. Google recommends using it for token storage, but as a developer, I don’t see why I shouldn’t store the last visited screen there to restore it on another device while switching from smartphone to tablet.

Nearby Connections API

The Nearby Connections API created to enable multi-device connections using Bluetooth, BLE, and Wi-Fi hotspots. API usage comes down to two different phases. The first phase establishes a connection between devices.

Here we have three different strategies to choose from:

  • P2P_CLUSTER – an M-to-N connection that enables multiple devices to start connections as well as receive connections from multiple devices
  • P2P_STAR – a 1-to-N connection, where the host cannot connect to other hosts
  • P2P_POINT_TO_PONT – a 1-to-1 connection that allows only two devices to connect at any given time

Remember that each strategy comes with its own advantages and disadvantages, so evaluate them carefully and choose the best one for your use case.

In the second phase, the host device can start to advertise its service. Before data transfer begins, all participants have to accept the requested connection. It is your decision whether the user will receive a prompt about a connection request – it can be done in the background silently by the application itself. When at least two devices connect, we can start to send payloads.

Data types available to be sent are:

  • Bytes Arrays
  • Files
  • Streams

Remember that file payload transfer is not completed until the onPayloadTransferUpdate receives a status update SUCCESS or ERROR. Until then, you can not guarantee that the received data is fully what has been sent. You can use this API to create temporary chat rooms, local multiplayer games, shared whiteboards, and share crucial information between users.

Nearby Messages API

The Nearby Messages API allows applications to publish small text messages to nearby devices via Bluetooth. Messages should be small, around 3 kB, but the API is able to send messages up to 100 kB. This API does not provide any security around who will receive broadcasted messages.

The baseline is that every installed application that connects to the same Google Cloud project is able to receive messages from the sender. However, you can manually enable all applications subscribed to public beacons to receive signals from your application.

Upcoming: Cross-device SDK

This year at Google I/O 2022, we were introduced to the incoming new SDK that will allow developers to create a multi-device SDK that is faster, more efficient, with better transparency to the user.

The SDK will include solutions for device discovery, and a nearby share prompt notification that will wake up the target device to allow it to establish a secure connection with the shared session. Session creation will allow users to choose between a single one-to-one session, or enable multiple users to work on a single session such as a shopping cart on a food delivery app, or add their destination point in a taxi app.

The solutions for such functions are already there, but this SDK will dramatically reduce the code required to create secure and stable connections and guarantee easier data transfer.

Right now, all we can do is subscribe to notifications about upcoming changes or dive deep into Google's connectivity samples.

Create satisfying multi-device experiences for Android users

Users tend to change mobile devices often or own several devices and may experience frictions when, for example, they need to set up yet another app on a new device. Fortunately, different devices can work well together now. With the tools from Google, Android developers can create multi-device experiences for users. Thanks to this, digital products can be more useful and more accessible for everyone.

Photo of Mariusz Karwowski

More posts by this author

Mariusz Karwowski

Senior Android Developer at Netguru
Mobile app development   Enhance your business by creating a mobile app with powerful custom features  and outstanding UX Read the story

Read more on our Blog

Check out the knowledge base collected and distilled by experienced professionals.

We're Netguru

At Netguru we specialize in designing, building, shipping and scaling beautiful, usable products with blazing-fast efficiency.

Let's talk business