Bug 15112 - EventHandler ReachabilityChanged not getting called in Reachability sample.
Summary: EventHandler ReachabilityChanged not getting called in Reachability sample.
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.4.4
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2013-10-01 19:49 UTC by Jon Goldberger [MSFT]
Modified: 2013-10-02 04:34 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
ReachabilitySample with breakpoints (571.27 KB, application/zip)
2013-10-01 19:49 UTC, Jon Goldberger [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jon Goldberger [MSFT] 2013-10-01 19:49:35 UTC
Created attachment 5033 [details]
ReachabilitySample with breakpoints

I've been toying around with the Reachability sample<https://github.com/xamarin/monotouch-samples/tree/master/ReachabilitySample>; in an attempt to get an event I can subscribe to when reachability changes (toggle of network connectivity).

From what I can tell, this example is supposed to raise the OnChange event because they're running the NetworkReachability.SetCallBack() and .Schedule() methods. I'm not catching the event at all when I push the app to my phone and turn on airplane mode.

I guess this is somewhat a two-part question:

1. How can I wire up a "ReachabilityChanged" event to fire since this example doesn't [seem to] work?
2. What's the best way to force the "ReachabilityChanged" event to fire on a simulator? (Should deploy to device and turn on Airplane mode cause the event to fire?)
=====================================================================================================
Comment 3 Rolf Bjarne Kvinge [MSFT] 2013-10-02 04:08:47 UTC
1. Add this to the FinishedLaunching method:

Reachability.ReachabilityChanged += (object sender, EventArgs e) =>  { UpdateStatus (); };

you'll also need to add a "tableView.ReloadData ();" at the end of "UpdateStatus ();" for the UI to update after the changes.

2. You need to turn internet access off on the machine itself. Exactly how depends on your network configuration.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2013-10-02 04:34:05 UTC
I didn't realize this was using our own monotouch-samples/ReachabilitySample.

I've now fixed the sample.

monotouch-samples/master: 6e3f89f376e4920fa71a24153c48c20f561ef5f9