I am sure it must be me but I cant get past this one
I am trying to check the wifi state
I have lifted two bits of code from the net (each slightly different ) but
both give an unhadled excpetion to do with invalid cast exception
Version 1
ConnectivityManager connManager =
(ConnectivityManager)GetSystemService(Android.Content.Context.WifiService);
NetworkInfo mWifi =
connManager.GetNetworkInfo(Android.Net.ConnectivityType.Wifi);
if
(mWifi.IsConnectedOrConnecting)
{
// Do whatever
Toast.MakeText(this,"wifif is connecting",ToastLength.Long).Show();
}
Version 2
SupplicantState supState;
var wifiManager =
(WifiManager)GetSystemService(Android.Content.Context.WifiService);
WifiInfo wifiInfo = wifiManager.ConnectionInfo;
supState = wifiInfo.SupplicantState;
Both have the same system exception or more or less - referring to a type
cast
Yes I have enabled Access_Wifi in the manifest
Any ideas anyone ?
Also I want to the same for mobile connection - is the same approach
appropriate?
Best regards
John Murray
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid