Skip to main content

Android OTA Update Client

The Bort SDK includes a full OTA Update Client since version 3.7.0, which uses the Memfault Android OTA service to manage the OTA update process. This supports:

  • RecoverySystem-based updates.
  • Update Engine-based updates (also known as A/B or Seamless updates).
  • Checking for updates (both regularly in the background, and manually via the system Settings menu). Check interval can be configured dynamically on the Memfault dashboard.
  • Downloading updates (and resuming interrupted downloads).
  • UI notifications of available updates, and download progress.

In future updates, additional features will be supported:

  • Incremental updates (once supported by Memfault servers - no client updates will be required).
  • Further remote configuration of update behavior (e.g. headless update behavior, force-update policy).

OTA Update Client behavior#

This behavior can be customized by modifying the bort-ota application. More behavior will be remotely configurable in future releases of the OTA Update Client.

The OTA Update Client will periodically check for updates. By default, this happens every 12 hours. When an update is found, a notification is displayed.

info

This regular, periodic check will only happen when:

  • Storage is not low.
  • Battery is not low.
  • An unmetered network connection (e.g. wifi) is available.

A "Software Updates" system settings screen is added. Users can manually check for updates on this screen.

When an update is found, the notification will redirect users to the settings screen, where they can read release notes, download, and apply the update.

OTA Update Client architecture#

The OTA Update Client is included in the Bort SDK as a separate app. As with the rest of the Bort SDK, this is open-source, and can be found in the bort-ota project.

The OTA Update Client is optional, and will not be included in your system image if not required.

The bort-ota app is designed to be customizable (for example, to customize the notification UI). All customizations should be made within the bort-ota project.

The bort-ota-lib library project contains the core OTA logic, and is not intended to be customized.

The OTA Update Client required the main Bort application to be installed and running, in order to function correctly.

Enable OTA Update Client#

Ensure that the Bort OTA application ID is set (see Patch the SDK or manually update BORT_OTA_APPLICATION_ID in bort.properties).

The OTA app also needs to be configured with a keystore. See Create a keystore for the OTA Update Client app.

Once the OTA application is configured, setting the TARGET_USES_MFLT_OTA environment variable will include it in the system image. e.g.

export TARGET_USES_MFLT_OTA=1

After building and installing the system image, the Memfault OTA app will be active. A release can now be deployed to the cohort containing this device.

Customizing the OTA Update Client#

String translations#

The strings used in the various UI elements (notifications, check for updates screen) are located in bort-ota/src/main/res/values/strings.xml. You may want to either customize, or translate these into other languages. See the Android documentation for more information.

Updating the OTA Update Client#

The OTA Update Client application can (just like the main Bort application) be updated using the Android package manager. If a device has an MDM capability, then this can be used to update the OTA apk in the future, without a full OS update.

It may still be necessary to update the OS for certain new features, if they required AOSP modifications.

Testing OTA updates#

It is recommended to thoroughly test the entire OTA update process after integrating the OTA Update Client. This should always include testing the ability to update from any new OS version.

Troubleshooting#

Ensure that the TARGET_USES_MFLT_OTA environment variable is set in the environments where both the gradle build, and AOSP build, take place. Without this, the OTA app will not be included, or may not be correctly configured.