You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
private fun checkConnectivity(context: Context) {
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val activeNetwork: NetworkInfo? = cm.activeNetworkInfo
val isConnected: Boolean = activeNetwork?.isConnectedOrConnecting == true
//Alert Dialog box
val alertDialog: AlertDialog? = this.let {
val builder = AlertDialog.Builder(it)
builder.apply {
setPositiveButton(R.string.OK,
DialogInterface.OnClickListener { dialog, id ->
// User clicked OK button
})
}
builder.setTitle(R.string.no_internet_connexion)
builder.setMessage(R.string.offline_message)
// Create the AlertDialog
builder.create()
}
if (!isConnected) {
alertDialog?.show()
}
}
Line in bold is deprecated according to Android Studio.
The text was updated successfully, but these errors were encountered:
Line in bold is deprecated according to Android Studio.
The text was updated successfully, but these errors were encountered: