-
Notifications
You must be signed in to change notification settings - Fork 2
react to offline
github-actions[bot] edited this page Jun 2, 2026
·
1 revision
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.material3.Text
import com.mobilebytelabs.kmptoolkit.networkmonitor.compose.collectIsOnlineAsState
@Composable
fun OfflineBanner() {
val online by collectIsOnlineAsState()
if (!online) {
Text("You're offline — changes will sync when reconnected.")
}
}-
JS / wasmJs: signal source is
navigator.onLine— known to lie on some desktop browsers (returns true even on captive-portal failures); pair with a background-ping for high-stakes flows. - iOS: monitors NWPathMonitor on a dedicated dispatch queue; first emission arrives ~50ms after first observer subscribes.
-
Linux: parses
/proc/net/routefor default-gateway presence on a 5s tick.
- Module: cmp-network-monitor-compose + cmp-network-monitor
- Sample:
samples/sample-cmp-network-monitor/composeApp/.../OfflineDemo.kt - See also: Run a block only when online for one-shot patterns.
** Partials**
App Intents
Bubble
Clipboard
Cookbook
- Clipboard Copy Text
- Clipboard Read Text
- Consumer Anon Key Setup
- Crashlytics Attribution Per Library
- Ifonline Block
- Index
- Index
- Index
- Index
- Open Url Compose
- Pick And Share Image
- React To Offline
- Register Firebase Hooks
- Share Pdf Android
- Share Text
- Wifi Vs Cellular
Firebase Analytics
In App Update
Intent Launcher
Inter App Comms
Modules
- Cmp App Intents
- Cmp App Intents Compose
- Cmp Bubble
- Cmp Clipboard
- Cmp Deep Link
- Cmp Firebase Analytics
- Cmp In App Update
- Cmp Intent Launcher
- Cmp Intent Launcher Compose
- Cmp Library
- Cmp Network Monitor
- Cmp Network Monitor Compose
- Cmp Observe
- Cmp Observe Koin
- Cmp Open Url
- Cmp Pdf Generator
- Cmp Product Tickets
- Cmp Remote Config
- Cmp Share
- Cmp Share Compose
- Cmp Toast
Network Monitor
Open Url
Pdf Generator
Remote Config
Share
Toast
User Tickets
General