I have the
compileSdkVersion 29
and
targetSdkVersion 29
in my android
app. And to check if there is a connection I use the next code:
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager?
return connectivityManager?.activeNetworkInfo?.isConnected ?: false
But with my targetSdk
the activeNetworkInfo
is deprecated. How can I check the connection status without deprecated methods and variables?