Tony
Tony

Reputation: 1185

Android error TYPE_WIFI canot be resolved or is not a field?

  mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

TYPE_WIFI canot be resolved or is not a field

i get this error can anyone help me to fix it?

Upvotes: 1

Views: 232

Answers (1)

Houcine
Houcine

Reputation: 24181

try this Code :

ConnectivityManager connManager = (ConnectivityManager) this.getSystemService(CONNECTIVITY_SERVICE);

NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

i think you have something wrong with your imports , or the variable mWifi should be a NetworkInfo type. i've tried it and it works for me , so you have something wrong just with your imports , and exaclty the ConnectivityManager

Upvotes: 1

Related Questions