protected override void OnCreate(Bundle bundle) { OMGITServiceClient _client; EndpointAddress EndPoint = new EndpointAddress("https://webapps.oregonmed.net/OMGITWebservices/OMGMobileServices.svc"); BasicHttpBinding binding = CreateBasicHttp(); _client = new OMGITServiceClient(binding, EndPoint); _client.AddLogMessageTickerAppAsync("Reached OnCreate", string.Empty); base.OnCreate(bundle); /* * //To Do - acknowledge the message with a web service call to * BasicHttpBinding binding = new BasicHttpBinding * { * Name = "basicHttpBinding", * MaxBufferSize = 2147483647, * MaxReceivedMessageSize = 2147483647 * }; * TimeSpan timeout = new TimeSpan(0, 0, 30); * binding.SendTimeout = timeout; * binding.OpenTimeout = timeout; * binding.ReceiveTimeout = timeout; */ global::Xamarin.Forms.Forms.Init(this, bundle); string confirmToken = this.Intent.GetStringExtra("confirmToken"); string alertMessage = this.Intent.GetStringExtra("alertMessage"); if (confirmToken != null && alertMessage != null) { LoadApplication(new App(alertMessage)); _client.AcknowledgeNotificationAsync(confirmToken, GlobalData.loginData); } else { LoadApplication(new App()); } try { // Check to ensure everything's setup right GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); // Register for push notifications System.Diagnostics.Debug.WriteLine("Registering..."); GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS); } catch (Java.Net.MalformedURLException) { CreateAndShowDialog("There was an error creating the Mobile Service. Verify the URL", "Error"); } catch (Exception e) { CreateAndShowDialog(e.Message, "Error"); } }
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action <UIBackgroundFetchResult> completionHandler) { NSDictionary aps = userInfo.ObjectForKey(new NSString("aps")) as NSDictionary; //NSString trackid = userInfo.ObjectForKey(new NSString("trackid")) as NSString; //string track = string.Empty; if (aps.ContainsKey(new NSString("alert"))) { alert = (aps[new NSString("alert")] as NSString).ToString(); } if (aps.ContainsKey(new NSString("alertMessage"))) { alertMessage = (aps[new NSString("alertMessage")] as NSString).ToString(); } if (aps.ContainsKey(new NSString("confirmToken"))) { confirmToken = (aps[new NSString("confirmToken")] as NSString).ToString(); } //if (trackid != null) // track = trackid.ToString(); //show alert if (!string.IsNullOrEmpty(alert)) { UIAlertView avAlert = new UIAlertView("Notification", alert, null, "OK", null); avAlert.Show(); avAlert.Clicked += changePage; OMGITServiceClient _client; EndpointAddress EndPoint = new EndpointAddress("https://webapps.oregonmed.net/OMGITWebservices/OMGMobileServices.svc"); BasicHttpBinding binding = CreateBasicHttp(); _client = new OMGITServiceClient(binding, EndPoint); _client.AcknowledgeNotificationAsync(confirmToken, GlobalData.loginData); } }