What is alternative to ConnectivityManager.TYPE_WIFI deprecated in Android P API 28?
问题 ConnectivityManager.TYPE_WIFI is deprecated in Android P API 28. Also, NetworkInfo#getType and ConnectivityManager.TYPE_MOBILE's are also deprecated. So, what are the alternatives for them? I understood that the we've to use the method from NetworkCapabilities class. However I'm not able to merge all the things in one place like how to do getType() in NetworkCapabilities class and how to add the WIFI and cellular data checks on it? Please assist. 回答1: ConnectivityManager.TYPE_WIFI is