Setting up iOS
iOS is very simple to set up and listens for events. The basis for the majority of code is based on the freely available Reachability.cs
class from Xamarin (https://github.com/xamarin/monotouch-samples/blob/master/ReachabilitySample/reachability.cs).
This class contains just about everything required to check your connection. In AppDelegate.cs
, a small amount of code is needed to get the ConnectionChanged
event:
// set up notifications var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType, null); UIApplication.SharedApplication.RegisterUserNotificationSettings(settings); // produce notification MessageEvents.Change += (object s, UIChangedEventArgs ea) => { if (ea.ModuleName == "Notification") { var notification = new UILocalNotification { FireDate = DateTime.Now, AlertAction = "Connection changed", AlertBody = ea.Info, }; UIApplication.SharedApplication...