How to know whether Android is connected to WiFi or ethernet? -


how know whether i'm connected wifi or ethernet in android? in android os notified thess icons enter image description here

does exist way know programmatically?

is enough?

connectivitymanager connmanager = (connectivitymanager) getsystemservice(context.connectivity_service); networkinfo wifi = connmanager.getnetworkinfo(connectivitymanager.type_wifi); if (wifi.isconnected()) { return true; } 

also, wifi details:

wifimanager wifimanager = (wifimanager) getsystemservice(context.wifi_service); wifiinfo wifiinfo = wifimanager.getconnectioninfo(); return wifiinfo.getssid() 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -