由于种种原因,这是行不通的:
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
请确保您有使用你的清单中声明的WiFi正确的权限。我想你会需要 ACCESS_WIFI_STATE
在的最小值,或者如果你想启用的WiFi过,那么的 CHANGE_WIFI_STATE
会派上用场。
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.