sdk / com.memfault.cloud.sdk / ChunkSender

ChunkSender

class ChunkSender

Send chunks for a given device to Memfault's web services.

One chunk sender must be created for each device; all chunk senders can then share the same MemfaultCloud instance.

Initialization

Use the Builder to instantiate a ChunkSender:

Kotlin:

val chunkSender = ChunkSender.Builder()
  .setMemfaultCloud(memfaultCloud)
  .setDeviceSerialNumber(deviceSerial)
  .build()

Java:

final ChunkSender chunkSender = new ChunkSender.Builder()
  .setMemfaultCloud(memfaultCloud)
  .setDeviceSerialNumber(deviceSerial)
  .build()

Persistent Queuing

By default, the ChunkSender's queue lives in memory. If the application is closed or crashes with chunks un-sent, they will be lost.

If this is an issue for your application, you can provide the ChunkSender with a ChunkQueue that is persistent.

Types

Builder

Build a ChunkSender instance for a given device.

class Builder

Functions

addChunks

Enqueue the chunks for the given device.

fun addChunks(chunks: List<ByteArray>): Boolean

send

Attempt to drain all chunks for the given device.

fun send(callback: SendChunksCallback): Unit