Hello boys,
I'm a beginner android programmer.
In my application I want active wifi, but I've a problem when test my application on my HTC DESIRE.
This is The code that I've write:
The problem is that, if the Wifi is enabled my application turn off the wifi, but don't work if the wifi is disabled and I want enable.
NOTE: I've insert this permission in the manifest file
Why the Wifi not enabled?? Is a problem of Sense Interface? Can you help me?
I'm a beginner android programmer.
In my application I want active wifi, but I've a problem when test my application on my HTC DESIRE.
This is The code that I've write:
Code:
if(cur.getString().equals("false"))
if((wifiManager.getWifiState() != WifiManager.WIFI_STATE_DISABLED) && wifiManager.isWifiEnabled())
wifiManager.setWifiEnabled(false);
else if(cur.getString().equals("true"))
if((wifiManager.getWifiState() != WifiManager.WIFI_STATE_ENABLED) && !wifiManager.isWifiEnabled())
wifiManager.setWifiEnabled(true);
NOTE: I've insert this permission in the manifest file
Code:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
<uses-permission android:name="android.permission.UPDATE_DEVICE_STATS"></uses-permission>