Uploading Android Diagnostic Data
Through the Android SDK
When configured with a Memfault Project Key, the Android SDK will automatically start uploading device diagnostics information into Memfault.
During development, it makes sense to configure the Android SDK to send data at a higher frequency. You can do this by enabling Developer Mode
Using the Memfault CLI
This guide assumes the Memfault CLI tool installed. If it is not installed it yet, please follow the installation instructions.
There are a few ways to upload data with the CLI. The following examples will use an Organization Auth Token. Please refer to the Memfault CLI Authentication section for more information about the different forms of authentication.
Uploading a MAR file
A Memfault Archive File (MAR) is an archive format that is generated by the Bort SDK containing many files in a compressed ZIP archive. The rationale behind creating and using a bundle containing many files is:
- To minimize data bandwidth and HTTP requests for cellular devices and minimize CPU and power consumption for battery-operated devices.
- To make it easier for customers to send large amounts of device-generated data to Memfault.
- To be able to send Memfault-specific data alongside the raw files that the operating system creates, such as Android Tombstone files.
- To be able to associate data within a MAR file to multiple devices. This enables our Android Multi-Device support.
To upload a MAR file that is located at, for example /path/to/device-data.mar
,
run the appropriate command:
The Software Type, Software Version, Hardware Version, and Device Serial parameters of the CLI command below should match that of the device which generated the MAR file.
$ memfault \
--org-token <Memfault-Project-Key> \
--org <ORG_SLUG> \
--project <PROJ_SLUG> \
upload-mar /path/to/device-data.mar
--software-type "android-build"
--software-version <DEVICE SOFTWARE VERSION>
--hardware-version <DEVICE HARDWARE VERSION>
--device-serial <DEVICE SERIAL NUMBER>
Uploading a Bug Report
To upload a bugreport.zip file that is located at, for example
/path/to/bugreport.zip
, run the appropriate command:
$ memfault \
--org-token <Memfault-Project-Key> \
--org <ORG_SLUG> \
--project <PROJ_SLUG> \
upload-bugreport /path/to/bugreport.zip
Uploading Diagnostic Data via API
Please consult the HTTP API Upload documentation for details on how to upload files to Memfault using the API.
Using the Memfault UI
For Android, only bug reports can be uploaded through the Memfault web application UI at this time.
Bug reports can be captured either using the adb bugreport
command or via the
Developer Options menu on the device. For more information, please refer to the
Android documentation.
Once you have captured a BugReport.zip file from a device, you can upload it via the Memfault UI by navigating to the Issues page and selecting Manual Upload.