Offline queue
implementation("com.cimka:cimka-offline:1.1.1")Cimka.initialize(this)CimkaOffline.register()How it works
Section titled “How it works”When a crash, trace, screen or network log can’t be delivered, it is appended to a file in the app’s private filesDir (one newline-delimited JSON file per log type). On the next app launch, once the SDK is ready, queued logs are resent and removed when delivered.
- Each file is capped at 2 MB; when the cap is reached the oldest half is dropped.
- Click and lifecycle events are not queued.
- Unsent crash reports are the main beneficiary: a crash on a flaky network is delivered on the next start.
Custom store
Section titled “Custom store”To store logs elsewhere (encrypted storage, a database…), implement CimkaOfflineStore and register it instead of CimkaOffline:
import com.xhonaldo.cimka.offline.CimkaOfflineStore
class EncryptedStore(private val context: Context) : CimkaOfflineStore { override fun save(bucket: String, json: String) { /* append */ } override fun readAll(bucket: String): List<String> = /* ... */ emptyList() override fun clear(bucket: String) { /* ... */ } override fun exists(bucket: String): Boolean = /* ... */ false}
Cimka.registerOfflineStore(EncryptedStore(this))This interface lives in the core cimka module, so you don’t need cimka-offline to use it.