The MemfaultCloud library provides convenience APIs for mobile applications that interact with Memfault's web services.
The sample/
directory contains a very basic Android application that
demonstrates the functionality of this library. Feedback from user interactions
is logged to LogCat and displayed as Toasts.
Before building the app, make sure to update the Project key in
SampleViewModel.kt
.
Add the library to your application's build.gradle
:
dependencies {
implementation 'com.memfault.cloud:cloud-android:2.0.5'
}
The artifact is hosted on the
Maven Central Repository, so you may
need to add mavenCentral()
to your list of project repositories. See the
sample app's root build.gradle
for an example.
repositories {
mavenCentral()
google()
}
The
MemfaultCloud
class is the main entry point for the MemfaultCloud
SDK. We recommend creating
only one MemfaultCloud
instance and using it across your entire application.
Use the memfaultCloud.getLatestRelease API to query Memfault's services to find if a new update is available for a device.
The Memfault Firmware SDK packetizes data to be sent to Memfault's cloud into "chunks". See this tutorial for details.
Once you have established sending chunks from your device to the Android app, use the ChunkSender API to upload these chunks to Memfault.
We used Square's excellent OKHTTP library as a reference when implementing this SDK's HTTP code.