I made this super lightweight library to enable Android Developers handle network changes across API 16 to 30.
mbobiosio / ConnectivityLiveData
A super simple, super light-weight lifecycle aware solution written in Kotlin that helps you to capture network connectivity events with support for lower APIs
A super simple, super light-weight lifecycle aware solution written in Kotlin that helps you to capture network connectivity events with support for lower APIs
USAGE
Including in your project
Add below codes to your root build.gradle
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Add lifecycleconnectivity dependency to your project's module build.gradle
implementation 'com.github.mbobiosio:lifecycleconnectivity:1.0.2'
- Use in your Activity
val lifecycleService = LifecycleService(this)
lifecycleService.observe(this, {
Log.d("Status", "$it")
})
- Use in your Fragment
val lifecycleService = LifecycleService(activity as Activity)
lifecycleService.observe(viewLifecycleOwner, {
})
Contribute
If you want to contribute to this app, you're always welcome See Contributing Guidelines.
📝 License
This project is released under the MIT license See LICENSE for details.
MIT License
Copyright (c) 2020 Mbuodile Obiosio
Permission is hereby granted, free of charge, to any person obtaining a copy
…Feel to create a pull request.
Top comments (0)