One of the things android 10 is changing is that we cannot get READ_PHONE_STATE automatically, And have to direct the user to manually give the permission by going to app info > permissions > phone > turn on.
is there any way to get network state (if the phone is on wifi / 3g, etc) on android 10 and above Without directing the user to go to the application settings by himself and change the permission manually?
I was thinking to bypass the permission asking with
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkCapabilities caps = cm.getNetworkCapabilities(cm.getActivityNetwork());
boolean isMobile = caps.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR);
boolean isWifi = caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
would that be ok and then not needed to use the READ_PHONE_STATE permission ?