Skip to main content
Offline support is off by default. You turn it on once, at initialization, by attaching an OfflineConfig to your AppSettings. Until you do, the SDK behaves exactly as before. This page covers the minimal setup; for every tunable option see the Configuration & API Reference.
1

Requirements

Offline support requires CometChat Android SDK 5.1.0 or later (minSdk 21). Add or update the dependency:
If you are new to the SDK, complete the standard setup first; the steps below only add offline configuration to your existing init.
2

Build an OfflineConfig

Construct an OfflineConfig with its fluent Builder and call enabled(true). Every other field has a sensible default, so set only what you need.
3

Attach it to AppSettings

Pass the config to AppSettingsBuilder.setOfflineConfig(...). To enable with all defaults instead of building a config, use the offline(boolean) shorthand.
If you call both setOfflineConfig(...) and offline(boolean), the explicit OfflineConfig wins — its enabled value is authoritative.
4

Initialize the SDK

Pass the settings to CometChat.init(...) as you do today. No other call changes.
5

Verify it is active

Call CometChat.isOfflineEnabled(). It returns true only while offline support is actually active for the logged-in user. It is false before anyone logs in (even when you enabled it in AppSettings), after logout or session expiry, and when the encrypted cache cannot open. Read it at the moment of each decision and keep no copy of the result.

Next steps

Offline support is now active for the logged-in user. Continue with Show Cached Data to adopt the new fetch listeners, and Send While Offline for the durable outbox. Tune caps, TTLs, media, and encryption from the Configuration & API Reference.