• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Wifi Status of Android device

gurus257

Newbie
hi all

I have to find out the Wireless Network status whether it is ON/OFF at the moment for an android device using python/monkeyrunner/java

could anyone help me on this??


thanks in advance
 
Java code:
Code:
WifiManager wm = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
if (wm.isWifiEnabled())
{
//do stuff that required wifi on
}
else
{
//do stuff that doesn't require wifi
}
You also need this permission:
Code:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
 
HI Mixer

i tried the one which you gave. but apk is installing perfectly and when activity started in android device i am getting an error saying 'The application xyz(process com.android) has stopped unexpectedly. please try again'

can you please help me out more if you can??
 
Back
Top Bottom