Skip to content

ReachabilityCompose makes it easier to implement network listener in Jetpack compose. You can implement the listener with a single line of code without any additional configuration or permissions.

License

Notifications You must be signed in to change notification settings

rishadappat/ReachabilityCompose

Repository files navigation

ReachabilityCompose

jetpack-compose

Maven Central

ReachabilityCompose makes it easier to implement network listener in Jetpack compose. You can implement the listener with a single line of code without any additional configuration or permissions.

Step 1. Add the dependency

dependencies {
        implementation("in.appat:ReachabilityCompose:0.1.1")
}

Step 2. Replace

setContent{

}

with

setNetworkListenerContent{

}

Thats it.

If you want to show the message in any other view, you can use the below compose.

ReachabilityStatus(modifier = Modifier)

If you want only the network state, use the below method.

val connection by reachabilityState()
Demo.mp4

About

ReachabilityCompose makes it easier to implement network listener in Jetpack compose. You can implement the listener with a single line of code without any additional configuration or permissions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages