MemfaultCloud

The Memfault SDK entrypoint.

Initialization

We recommend creating only one instance of MemfaultCloud and using it across your entire application. Use the Builder to create an instance.

Kotlin:

val memfault = MemfaultCloud.Builder()
.setApiKey(PROJECT_KEY)
.build()

Java:

final Memfault memfault = new Memfault.Builder()
.setApiKey(PROJECT_KEY)
.build();

To find your PROJECT_KEY, log in to [https://app.memfault.com/] and navigate to Settings.

Getting the Latest Release

You can check to see whether there's a new update for a particular device with MemfaultCloud.getLatestRelease:

Kotlin:

memfaultCloud.getLatestRelease(deviceInfo, callback = object : GetLatestReleaseCallback {

override fun onUpdateAvailable(otaPackage: MemfaultOtaPackage) {
// There's a new software package
}

override fun onUpToDate() {
// Device is up to date, nothing to do!
}

override fun onError(e: Exception) {
// There was an error; handle it here
}
})

Java:

final GetLatestReleaseCallback callback = new GetLatestReleaseCallback() {
@Override
public void onUpdateAvailable(@NonNull MemfaultOtaPackage otaPackage) {
// There's a new software package
}

@Override
public void onUpToDate() {
// Device is up to date, nothing to do!
}

@Override
public void onError(@NonNull Exception e) {
// There was an error; handle it here
}
};
memfaultCloud.getLatestRelease(callback);

Permissions

The SDK requires several permissions in order to implement all functionality. Callers should check for these permissions and, if necessary, request them[https://developer.android.com/training/permissions/requesting] from the user.

Types

Link copied to clipboard
class Builder

Build a new MemfaultCloud instance.

Link copied to clipboard
object Companion
Link copied to clipboard

Functions

Link copied to clipboard
fun deinit()

Stop and clean up any active tasks.

Link copied to clipboard

Queries Memfault's services to find if a new update is available.