I have a need to monitor the state of the network connections in my
application. I have setup a BroadcastReceiver on
ConnectivityManager.ConnectivityAction to do this. 

...
mWiFiReceiver = new NetworkStateChanged();
this.RegisterReceiver(mWiFiReceiver, new
IntentFilter(ConnectivityManager.ConnectivityAction));
...

...
[BroadcastReceiver]
public class NetworkStateChanged : BroadcastReceiver
{
        public override void OnReceive(Context context, Intent intent)
        {
            Log.Debug("TESTME, "Got an OnReceive inside the
NetworkStateChanged ...");
         }
}
...

This seems to work great giving me notifications. 

But the JAVA example i was following uses getParcelableExtra to obtain the
NetworkInfo. 

@Override
  public void onReceive(Context arg0, Intent arg1) {
  
   NetworkInfo networkInfo = (NetworkInfo)
arg1.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
   if(networkInfo.getType() == ConnectivityManager.TYPE_WIFI){
    DisplayWifiState();
   }

I can only find a GetParcelableArrayExtra in monodroid API. Can someone
point me to a monodroid way of getting the NetworkInfo from the OnReceive
Intent?

Thanks for your help,
Dennis

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Detecting-Network-connectivity-state-changes-tp4394070p4394070.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to