This is a sample library use for check network connection
We can install this library by using gradle
Step 1
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Step 2
dependencies {
compile 'com.github.TuonBondol:NetworkUtil:1.0.2'
}
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
btnCheckNetwork.setOnClickListener {
if(!isNetworkConnected(this)){
Toast.makeText(this, "Network is not Connected!", Toast.LENGTH_LONG).show()
return@setOnClickListener
}
Toast.makeText(this, "Network is Connected!", Toast.LENGTH_LONG).show()
}
}
}
Support Min Sdk version >= 16
- Bondol Tuon - Bondol Tuon
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the [LICENSE.md]https://github.com/BondolTuon/NetworkUtil/blob/master/README.md) file for details