views:

58

answers:

1

For some reasons, this ain't working:

    wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);

    if(wifi.isWifiEnabled())
    {
        tvStatus.setText("You WiFi is enabled");
    }
    else
    {
        tvStatus.setText("You WiFi is disabled");
    }

Why aint this working, am i missing something? And it compiles and everything but when i want to run it on my phone it gives me a force quit error

+1  A: 

Make sure you have the right permissions for using WiFi declared in your Manifest. I think you will be needing ACCESS_WIFI_STATE at a mininum, or if you wish to enable WiFi too, then CHANGE_WIFI_STATE will come in handy.

codinguser