Assuming both WIFI and Data / 3G are installed on the device, how to check if the user is currently using the Internet via Wi-Fi or a data plan, assuming that they are both turned on. Therefore, I do not need to check whether they are enabled or disabled, I would like to determine which user is using it.
I did the following: is this the only solution?
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); if (WifiInfo.getDetailedStateOf(wifiInfo.getSupplicantState()) == NetworkInfo.DetailedState.CONNECTED) { String ssid = wifiInfo.getSSID(); }
android
ARMAGEDDON
source share