Skip to main content

Android Multi-Device Support

Your product might consist of multiple Android devices connected together, where not all of the devices have direct internet access - this presents a challenge uploading diagnostics (and downloading settings) from the un-connected companion devices.

The Android SDK (since version 4.0) supports offloading data from the companion devices, if there is a socket connection available to communicate between them. We call this client-server mode and it allows all participating devices to communicate with Memfault while only the server device is connected to the Internet.

Client-Server mode

Disabled by default, Bort's client-server mode allows designating a network-connected Android device running the Android SDK as server. One or more connected devices without direct network access can be designated client.

Bort running on the client device will collect and forward diagnostic data to Bort running on the server device via a socket connection, so that the data can be forwarded to Memfault's web services.

Data is bundled together in a MAR archive. This compressed file format collects several types of data (e.g. logs, metrics, bug reports) together, so that they can be uploaded in one file - resulting in fewer HTTP requests.

Supported features

All data collected by Bort (bugreports, logs, metrics, crashes/WTFs/ANRs/etc) is forwarded from client devices to Memfault's web services when using client-server mode.

Bort running on the server device will forward SDK settings to the client device - this ensures that Bort on both devices is always fully remotely configurable.

Enabling Client-Server connectivity

This mode is disabled by default. To enable, there are two configuration steps:

Configure Client-Server system property on each device

Set a system property (vendor.memfault.bort.client.server.mode) on each of the devices, describing its role. This might be set in a product.mk file specific to each device e.g.:

PRODUCT_PROPERTY_OVERRIDES += vendor.memfault.bort.client.server.mode=server

or

PRODUCT_PROPERTY_OVERRIDES += vendor.memfault.bort.client.server.mode=client

If this property is absent, or not set to either server or client then the client-server feature is disabled.

info

This property is configured individually per device. A system property is used for this reason (so that the Android SDK does not have to be configured/compiled separately for each device).

Configure socket communication parameters

Set the CLIENT_SERVER_PORT and CLIENT_SERVER_HOST parameters in bort.properties. The server device must be able to listen for connections on this port, and the client devices must be able to communicate with the server using this hostname and port.

The UsageReporter persistent service on the server device will listen for connections on this host/port, and on client devices will attempt to establish a connection with the server device.

info

This property is configured as part of the Bort build - this enables the use of the same Bort/UsageReporter apks on each of the devices (i.e. it is not required to maintain/build separately configured versions of the Android SDK for each of the connected Android devices).

Configure network interfaces

Ensure that device network/firewall configuration is set up so that the client/server devices can communicate using the hostname/port specified in your bort.properties file.

For security reasons, the network interface that the server device is listening on should not be publicly accessible - it is expected to be an interface which can only communicate with the client device.