private void OnLogout(NSDictionary onLogout) { if (onLogout != null) { Console.WriteLine("OnLogout " + onLogout.ToString()); } }
private void OnMessageRecieve(NSDictionary messageRecieve) { if (messageRecieve != null) { Console.WriteLine("Login Fail " + messageRecieve.ToString()); } }
private void OnLaunchSuccess(NSDictionary launchSuccess) { if (launchSuccess != null) { Console.WriteLine("OnLaunchSuccess " + launchSuccess.ToString()); } }
[Export("userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:")] //does it come after autologin? public void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action //called when app is in background, and user taps on notification completionHandler) { completionHandler(); NSDictionary userInfo = response.Notification.Request.Content.UserInfo; CommonMethods c = new CommonMethods(null); BaseActivity context = CommonMethods.GetCurrentViewController(); CommonMethods.LogStatic("DidReceiveNotificationResponse " + userInfo.ToString().Replace(Environment.NewLine, " ") + " logged in " + c.IsLoggedIn() + " context " + context); if (userInfo != null && userInfo.ContainsKey(new NSString("aps"))) { int senderID = ((NSNumber)userInfo.ObjectForKey(new NSString("fromuser"))).Int32Value; int targetID = ((NSNumber)userInfo.ObjectForKey(new NSString("touser"))).Int32Value; if (targetID != Session.ID) { return; } IntentData.senderID = senderID; if (!(context is ChatOneActivity)) { CommonMethods.OpenPage("ChatOneActivity", 1); } //otherwise foreground notification will refresh the page } }
private void OnGroupInfo(NSDictionary groupInfo) { if (groupInfo != null) { Console.WriteLine("OnGroupInfo " + groupInfo.ToString()); } }
/* * //This is the arlert notification * // * // */ public void alertNotification(UIApplication application, NSDictionary userInfo) { Console.WriteLine("Application" + application.ToString()); //Console.WriteLine("received userInfo.Decription :"+ userInfo.Description); Console.WriteLine("received userInfo.ToString received remote : " + userInfo.ToString()); var title = userInfo["Title"]; var body = userInfo["Body"]; Console.WriteLine("title : " + title); Console.WriteLine("body : " + body); //notification to Device UILocalNotification notification = new UILocalNotification(); var fireDate = DateTime.Now.AddSeconds(3); notification.FireDate = (NSDate)fireDate; //---- configure the alert stuff notification.AlertAction = body.ToString(); notification.AlertBody = title.ToString(); //---- modify the badge notification.ApplicationIconBadgeNumber = 1; //---- set the sound to be the default sound notification.SoundName = UILocalNotification.DefaultSoundName; // notification.UserInfo = new NSDictionary(); // notification.UserInfo[new NSString("Message")] = new NSString("Your 1 minute notification has fired!"); //---- schedule it new UIAlertView("hi this is title", "hi this is message", null, "OK", null).Show(); UIApplication.SharedApplication.ScheduleLocalNotification(notification); }
private void NetService_ResolveFailure(object sender, NSNetServiceErrorEventArgs e) { if (sender is NSNetService netService) { netService = (NSNetService)sender; Debug.WriteLine($"{nameof(NetService_ResolveFailure)}: Name {netService?.Name} Type {netService?.Type} Domain {netService?.Domain} " + $"HostName {netService?.HostName} Port {netService?.Port}"); NSDictionary errors = e.Errors; Debug.WriteLine($"{nameof(NetService_ResolveFailure)}: Errors {errors?.ToString()}"); if (errors != null) { if (errors.Count > 0) { foreach (var key in errors.Keys) { Debug.WriteLine($"{nameof(NetService_ResolveFailure)}: Key {key} Value {errors[key].ToString()}"); } } else { Debug.WriteLine($"{nameof(NetService_ResolveFailure)}: errors has 0 entries"); } } else { Debug.WriteLine($"{nameof(NetService_ResolveFailure)}: errors is null"); } } }
private void Browser_NotSearched(object sender, NSNetServiceErrorEventArgs e) { NSDictionary errors = e.Errors; Debug.WriteLine($"{nameof(Browser_NotSearched)}: Errors {errors?.ToString()}"); if (errors != null) { if (errors.Count > 0) { foreach (var key in errors.Keys) { Debug.WriteLine($"{nameof(Browser_NotSearched)}: Key {key} Value {errors[key].ToString()}"); } } else { Debug.WriteLine($"{nameof(Browser_NotSearched)}: errors has 0 entries"); } } else { Debug.WriteLine($"{nameof(Browser_NotSearched)}: errors is null"); } }
// iOS 9 <=, fire when recieve notification foreground public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action <UIBackgroundFetchResult> completionHandler) { if (App.AppSettings.EnableNotifications) { App.AddLog("GCM: Notification received"); App.AddLog(userInfo.ToString()); var body = WebUtility.UrlDecode(userInfo["gcm.notification.message"] as NSString); var title = WebUtility.UrlDecode(userInfo["gcm.notification.title"] as NSString); if (String.IsNullOrEmpty(title)) { title = WebUtility.UrlDecode(userInfo["gcm.notification.subject"] as NSString); } if (String.Compare(title, body, true) == 0) { title = "Domoticz"; } if (application.ApplicationState == UIApplicationState.Active) { debugAlert(title, body); } //else if (App.AppSettings.EnableNotifications) // CrossLocalNotifications.Current.Show(title, body); } }
private void loginsuccess(NSDictionary nsdictionary) { if (nsdictionary != null) { Console.WriteLine("Login Success " + nsdictionary.ToString()); BtnLaunchCometChat.Enabled = true; BtnLaunchCometChat.Hidden = false; } }
//public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) //{ // CrossAzurePushNotifications.Platform.ProcessNotification(userInfo); //} //public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) //{ // CrossAzurePushNotifications.Platform.RegisteredForRemoteNotifications(deviceToken); //} void ProcessNotification(NSDictionary options, bool fromFinishedLaunching) { // Check to see if the dictionary has the aps key. This is the notification payload you would have sent if (null != options && options.ContainsKey(new NSString("aps"))) { //Get the aps dictionary NSDictionary aps = options.ObjectForKey(new NSString("aps")) as NSDictionary; Console.WriteLine(aps.ToString()); string alert = string.Empty; string title = string.Empty; if (aps.ContainsKey(new NSString("alert"))) { NSDictionary alertObj = aps.ObjectForKey(new NSString("alert")) as NSDictionary; if (alertObj.ContainsKey(new NSString("body"))) { alert = (alertObj[new NSString("body")] as NSString).ToString(); } Console.WriteLine($"============{alert}++++++++"); if (alertObj.ContainsKey(new NSString("title"))) { title = (alertObj[new NSString("title")] as NSString).ToString(); } } //Extract the alert text // NOTE: If you're using the simple alert by just specifying // " aps:{alert:"alert msg here"} ", this will work fine. // But if you're using a complex alert with Localization keys, etc., // your "alert" object from the aps dictionary will be another NSDictionary. // Basically the JSON gets dumped right into a NSDictionary, // so keep that in mind. //if (aps.ContainsKey(new NSString("alert"))) //alert = (aps[new NSString("alert")] as NSString).ToString(); //NSDictionary alertDictionary = aps.ObjectForKey(new NSString("alert")) as NSDictionary; //string title = string.Empty; //if (alertDictionary.ContainsKey(new NSString("title"))) // title = (alertDictionary[new NSString("title")] as NSString).ToString(); //If this came from the ReceivedRemoteNotification while the app was running, // we of course need to manually process things like the sound, badge, and alert. if (!fromFinishedLaunching) { //Manually show an alert if (!string.IsNullOrEmpty(alert)) { //removed on 3/22/17 by aditmer - I think this is preventing alarms from playing. //UIAlertView avAlert = new UIAlertView(title, alert, null, "OK", null); //avAlert.Show(); } } } }
private void OnUserInfo(NSDictionary userInfo) { if (userInfo != null) { Console.WriteLine("OnUserInfo " + userInfo.ToString()); String push_channel = (userInfo["push_channel"] as NSString); Console.WriteLine("push_channel " + push_channel); CrossFirebasePushNotification.Current.Subscribe(push_channel); } }
private void InitSuccess(NSDictionary dict) { if (dict != null) { Console.WriteLine("Init Success " + dict.ToString()); superhero01.Hidden = false; superhero02.Hidden = false; superhero01.Enabled = true; superhero02.Enabled = true; } }
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { System.Console.WriteLine("OpenUrl 3"); System.Console.WriteLine("app = " + app.ToString()); System.Console.WriteLine("url = " + url.ToString()); System.Console.WriteLine("options = " + options.ToString()); string messageStr = url.ToString().Split(new char[] { '?' }) [1]; System.Console.WriteLine("messageStr = " + messageStr); return(true); }
public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) { Console.WriteLine(userInfo.ToString()); NSObject inAppMessage; bool success = userInfo.TryGetValue(new NSString("inAppMessage"), out inAppMessage); if (success) { var alert = new UIAlertView("Got push notification", inAppMessage.ToString(), null, "OK", null); alert.Show(); } }
public void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) //notification sent to the device while the notification permission was off are not received when the user turn permission on. { /* * userInfo { * aps = { * alert = { * body = S; * title = "New message from b"; * }; * }; * fromuser = 123; * inapp = 1; * meta = "71|123|1591561106|0|0"; * touser = 10; * type = sendMessage; * } */ CommonMethods.LogStatic("ReceivedRemoteNotification userInfo " + userInfo.ToString().Replace(Environment.NewLine, " ")); try { string title = ""; string body = ""; int senderID = ((NSNumber)userInfo.ObjectForKey(new NSString("fromuser"))).Int32Value; int targetID = ((NSNumber)userInfo.ObjectForKey(new NSString("touser"))).Int32Value; string type = userInfo.ObjectForKey(new NSString("type")) as NSString; string meta = userInfo.ObjectForKey(new NSString("meta")) as NSString; bool inApp = (((NSNumber)userInfo.ObjectForKey(new NSString("inapp"))).Int32Value == 0) ? false : true; NSDictionary aps = userInfo.ObjectForKey(new NSString("aps")) as NSDictionary; if (userInfo != null && aps.ContainsKey(new NSString("alert"))) { NSDictionary alert = aps.ObjectForKey(new NSString("alert")) as NSDictionary; title = alert.ObjectForKey(new NSString("title")) as NSString; body = alert.ObjectForKey(new NSString("body")) as NSString; } else if (userInfo.ContainsKey(new NSString("title"))) { title = userInfo.ObjectForKey(new NSString("title")) as NSString; body = userInfo.ObjectForKey(new NSString("body")) as NSString; // \\ already converted to \ } HandleNotification(senderID, targetID, type, meta, inApp, title, body); } catch (Exception ex) { CommonMethods c = new CommonMethods(null); c.ReportErrorSilent(ex.Message + " " + ex.StackTrace); } }
public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) { // NOTE: Don't call the base implementation on a Model class // see https://docs.microsoft.com/xamarin/ios/app-fundamentals/delegates-protocols-and-events Debug.WriteLine(userInfo.ToString()); NSObject inAppMessage; bool success = userInfo.TryGetValue(new NSString("inAppMessage"), out inAppMessage); if (success) { var alert = new UIAlertView("Got push notification", inAppMessage.ToString(), null, "OK", null); alert.Show(); } }
public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) { // NOTE: Don't call the base implementation on a Model class // see http://docs.xamarin.com/guides/ios/application_fundamentals/delegates,_protocols,_and_events Debug.WriteLine(userInfo.ToString()); NSObject inAppMessage; bool success = userInfo.TryGetValue(new NSString("inAppMessage"), out inAppMessage); if (success) { var alert = new UIAlertView("Got push notification", inAppMessage.ToString(), null, "OK", null); alert.Show(); } }
public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) { Console.WriteLine("Received Remote Notification!"); try { MyMoodLogger.Current.Log("Push notification received", userInfo.ToString(), 2); if (application.ApplicationState == UIApplicationState.Active) { //Console.WriteLine("Remote notification received but app not active"); } else { //Console.WriteLine("Posting RemoteNotificationRecieved"); NSNotificationCenter.DefaultCenter.PostNotificationName("RemoteNotificationRecieved", null, userInfo); } } catch (Exception ex) { //Console.WriteLine ("Error on receiving remote notification - " + ex.ToString ()); MyMoodLogger.Current.Error("Error on push notification", ex, 2); } }
public override void DidScanBarcode(SIOverlayController overlayController, NSDictionary barcode) { string code = barcode ["barcode"].ToString(); if (kindOfScan == KindOfScan.Save) { if (saveVC == null) { saveVC = ownerVC.Storyboard.InstantiateViewController("SaveViewControllerID") as SaveViewController; saveVC.IsShown = false; } if (saveVC.IsShown) { return; } saveVC.Code = code; ownerVC.PresentViewController(saveVC, true, null); } else { var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; using (var db = new SQLiteConnection(appDelegate.DatabasePath)) { var product = db.Table <Product> ().Where(p => p.Barcode == code).FirstOrDefault(); if (product != null) { new UIAlertView(product.Name, "The price of the product registered in the database is: " + product.Price.ToString(), null, "Ok", null).Show(); } else { new UIAlertView("Mmm...", "It seems that the product hasn't been registered before...", null, "Ok", null).Show(); } } } Console.WriteLine(barcode.ToString()); }
// For a push notification to trigger a download operation, the notification’s payload must include // the content-available key with its value set to 1. When that key is present, the system wakes // the app in the background (or launches it into the background) and calls the app delegate’s // application:didReceiveRemoteNotification:fetchCompletionHandler: method. Your implementation // of that method should download the relevant content and integrate it into your app. #pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void public override async void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action <UIBackgroundFetchResult> completionHandler) #pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void { Log.Debug($"\n{userInfo.ToString ()}"); // if (userInfo.TryGetValue (new NSString ("collectionId"), out NSObject nsObj) && nsObj is NSString nsStr) { } if (processingNotification) { Log.Debug($"Already processing notificaiton. Returning..."); completionHandler(UIBackgroundFetchResult.NewData); return; } processingNotification = true; Log.Debug($"Get All AvContent Async..."); try { await ContentClient.Shared.GetAllAvContent(); DeleteLocalUploads(); Log.Debug($"Finished Getting Data."); completionHandler(UIBackgroundFetchResult.NewData); } catch (Exception ex) { Log.Error($"FAILED TO GET NEW DATA {ex.Message}"); completionHandler(UIBackgroundFetchResult.Failed); } finally { processingNotification = false; } }
public override NSObject ReceiveEvent(CoronaView view, NSDictionary pEvent) { if(OnReceive!=null){ OnReceive (view,pEvent); } //Console.WriteLine ("CoronaViewDelegate.ReceiveEvent:{0}",pEvent); return new NSString( pEvent.ToString()); }
public override void DidCancel(SIOverlayController overlayController, NSDictionary status) { Console.WriteLine(status.ToString()); }
public void ReceivedRemoteNotification(NSDictionary userInfo) { string message = null; NSObject aps = userInfo.ObjectForKey(new NSString("aps")); if (aps != null && aps.IsKindOfClass(new Class(typeof(NSDictionary)))) { var dict = (NSDictionary)aps; NSObject alert = dict.ObjectForKey(new NSString("alert")); if (alert != null && alert.IsKindOfClass(new Class(typeof(NSString)))) message = alert.ToString(); } if (message != null) BusinessProcessContext.Current.GlobalEventsController.OnPushMessage(message); else _applicaitonContext.HandleException(new NonFatalException(D.PUSH_NOTIFICATION_ERROR, userInfo.ToString())); }
public void ReceivedRemoteNotification(NSDictionary userInfo) { string message = null; NSObject aps = userInfo.ObjectForKey(new NSString("aps")); if (aps != null && aps.IsKindOfClass(new Class(typeof(NSDictionary)))) { var dict = (NSDictionary)aps; NSObject alert = dict.ObjectForKey(new NSString("alert")); if (alert != null && alert.IsKindOfClass(new Class(typeof(NSString)))) { message = alert.ToString(); } } if (message != null) { BusinessProcessContext.Current.GlobalEventsController.OnPushMessage(message); } else { _applicaitonContext.HandleException(new NonFatalException(D.PUSH_NOTIFICATION_ERROR, userInfo.ToString())); } }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow(UIScreen.MainScreen.Bounds); System.Threading.Thread.Sleep(1500); //splash time Parse.SetAppId(appid, clientid); /* * WithValidParseIds (delegate { * Parse.SetApplicationIdClientKey (appid, clientid); * * });; */ //loadData (); var controller = new UIHomeScreen(); int firstTime = NSUserDefaults.StandardUserDefaults.IntForKey("firstTime"); firstTime++; NSUserDefaults.StandardUserDefaults.SetInt(firstTime, "firstTime"); controller.firstTime = firstTime; navigationController = new UINavigationController(controller); window.RootViewController = navigationController; try { if (options.ContainsKey(new NSString("UIApplicationLaunchOptionsRemoteNotificationKey"))) { NSDictionary aps = options.ObjectForKey(new NSString("UIApplicationLaunchOptionsRemoteNotificationKey")) as NSDictionary; Console.WriteLine("entro aqui..."); string alert = "NADA"; if (aps.ContainsKey(new NSString("alert"))) { Console.WriteLine("trae alert aqui..."); alert = (aps [new NSString("alert")] as NSString).ToString(); alert = alert.Replace("Nuovo evento creato: ", ""); app.ApplicationIconBadgeNumber = 0; app.CancelAllLocalNotifications();//.ca controller.gotoEvent = true; controller.keyEvent = alert; var x = new UIAlertView("iPortogruaro", "Un nuovo evento è stato creato vuoi vedere?", null, "Annullare", "Ok"); x.Show(); x.Clicked += (sender, buttonArgs) => { int clicked = buttonArgs.ButtonIndex; if (clicked == 1) { var detail = new UIEventDetail(true); detail.key = alert; detail.Title = "Eventi"; this.navigationController.PushViewController(detail, true); //ReceivedRemoteNotification (app, aps); } }; } else if (aps.ContainsKey(new NSString("aps"))) { Console.WriteLine("NSDictionary: 123"); NSDictionary aps2 = aps.ObjectForKey(new NSString("aps")) as NSDictionary; Console.WriteLine("NSDictionary: " + aps2.ToString()); alert = (aps2 [new NSString("alert")] as NSString).ToString(); alert = alert.Replace("Nuovo evento creato: ", ""); Console.WriteLine(alert); app.ApplicationIconBadgeNumber = 0; app.CancelAllLocalNotifications(); //.ca controller.gotoEvent = true; controller.keyEvent = alert; var detail = new UIEventDetail(true); detail.key = alert; detail.Title = "Eventi"; this.navigationController.PushViewController(detail, true); } else { /* * { * aps = { * alert = "Nuovo evento creato: Evento Prova Gi\U00f2"; * }; * } */ Console.WriteLine("NSDictionary: " + aps.ToString()); JsonValue value = JsonObject.Parse(aps.ToString()); Console.WriteLine(value.ToString()); JsonValue ar = value ["aps"]; string msg = ""; foreach (JsonValue v in ar) { msg = v ["alert"].ToString().Replace("\"", ""); Console.WriteLine("json parse: " + msg); } controller.gotoEvent = true; controller.keyEvent = msg; } } } catch (Exception ex) { Console.WriteLine("error geting the push notifications Error: " + ex.Message); if (controller == null) { controller = new UIHomeScreen(); navigationController = new UINavigationController(controller); window.RootViewController = navigationController; } } //20130711 start if (window.RootViewController == null) { controller = new UIHomeScreen(); navigationController = new UINavigationController(controller); window.RootViewController = navigationController; } //20130711 end // make the window visible window.MakeKeyAndVisible(); //ValidateSetup (); //SetupUI (); GetLocation(); //string newDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken"); //Console.WriteLine("Device Token: " + newDeviceToken); registerNotifications(); return(true); }
private void RecieveNotification(NSDictionary userInfo) { SJMC.Helpers.Constants.IsNotificationClickedInKillState = true; SJMC.Helpers.Constants.tempString = userInfo.ToString(); try { if (userInfo["aps"] != null) { var aps_d = userInfo["aps"] as NSDictionary; //rootNotificationPayload = JsonConvert.DeserializeObject<RootNotificationPayload>(userInfo.ToString()); var alert_d = aps_d["alert"] as NSDictionary; var text = alert_d.ObjectForKey(new NSString("body")).ToString(); var newTitles = alert_d["title"] as NSString; var notificationType = userInfo.ObjectForKey(new NSString("notificationType")).ToString(); System.Threading.Tasks.Task.Run(() => { // do work here that you don't want on the UI thread Device.BeginInvokeOnMainThread(() => { //hamad //SJMC.Helpers.Settings.NotificationBadageCount -= 1; //CrossBadge.Current.SetBadge(SJMC.Helpers.Settings.NotificationBadageCount); }); }); if (SJMC.Helpers.Settings.NotificationBadageCount < 0) { SJMC.Helpers.Settings.NotificationBadageCount = 0; } if (notificationType.Contains("NEWS")) { int notiId = new Random().Next(0, 1000000); string newTitle = newTitles; string newsJson = userInfo.ObjectForKey(new NSString("news")).ToString(); //"123";//noti_id.ObjectForKey(new NSString("newsId")).ToString(); NotificationNewsPayLoad notificationNewsPayLoad = JsonConvert.DeserializeObject <NotificationNewsPayLoad>(newsJson); string newsId = notificationNewsPayLoad.newsId.ToString(); SJMC.Helpers.Settings.NewsNotificationOpen = true; var data = SJMC.Helpers.Settings.NewsNotificationList; data.Add(new Models.NotificationNewsOpenerModel { NewsId = newsId, NewsTitle = newTitle, NewsText = text, IsRead = false, NotificationId = notiId }); SJMC.Helpers.Settings.OpenNewsNumber = notiId; SJMC.Helpers.Settings.NewsNotificationList = data; SJMC.Helpers.Settings.NotificationKind = "SjmcNewsNotification"; } else { string reportJson = userInfo.ObjectForKey(new NSString("report")).ToString(); //"123";//noti_id.ObjectForKey(new NSString("newsId")).ToString(); NotificationReportPayLoad notificationReportPayLoad = JsonConvert.DeserializeObject <NotificationReportPayLoad>(reportJson); //string description = text.Substring(0, text.IndexOf("|-|")); //int startIndex = text.IndexOf("|-|") + 3; //string parameter = text.Substring(startIndex, (text.Length - startIndex) - 1); //string[] parameters = parameter.Split(";"); int notiId = new Random().Next(0, 1000000); //SJMC.Helpers.Settings.NotificationList = new List<Models.NotificationReportOpenerModel>(); var data = SJMC.Helpers.Settings.NotificationList; NotificationReportOpenerModel notificationReportOpenerModel = new NotificationReportOpenerModel() { ReportType = notificationReportPayLoad.ReportType, //parameters[0], AsBrch = notificationReportPayLoad.AsBrch, //parameters[1], AsYear = notificationReportPayLoad.AsYear, //parameters[2], AsRef = notificationReportPayLoad.AsRef, //parameters[3], IsRead = false, NotificationId = notiId }; data.Add(new Models.NotificationReportOpenerModel { ReportType = notificationReportPayLoad.ReportType, //parameters[0], AsBrch = notificationReportPayLoad.AsBrch, //parameters[1], AsYear = notificationReportPayLoad.AsYear, //parameters[2], AsRef = notificationReportPayLoad.AsRef, //parameters[3], IsRead = false, NotificationId = notiId }); SJMC.Helpers.Settings.NotificationList = data; SJMC.Helpers.Settings.OpenReportNumber = notiId; SJMC.Helpers.Settings.NotificationKind = "SjmcReportNotification"; } //base.DidReceiveNotificationResponse(center, response, completionHandler); if (SJMC.Helpers.Settings.NotificationKind == "SjmcReportNotification") { try { /// Do something now that you know the user clicked on the notification... //CrossBadge.Current.ClearBadge(); //SJMC.Helpers.Settings.OpenReportPage = true; /*string kkk = intent.GetStringExtra("SjmcNotificationId"); * SJMC.Helpers.Settings.OpenReportNumber = Convert.ToInt32(kkk); * * var winnerToast = Toast.MakeText(this, $"Opening your report...", ToastLength.Long); * winnerToast.SetGravity(Android.Views.GravityFlags.Bottom, 0, 0); * winnerToast.Show(); * * // App.Current.MainPage = new SJMC.Views.HomeView(); * // App.Current.MainPage = new NavigationPage(new HomeView()); * * //Toast.MakeText(this, "kkk: " + kkk, ToastLength.Long); * * FirebasePushNotificationManager.ProcessIntent(this, intent); * //App.Current.MainPage = new SJMC.Views.HomeView();*/ //App.Current.MainPage.Navigation.PushAsync(new SJMC.Views.HomeView(), true); } catch (Exception ex) { //Toast.MakeText(this, "OnNewIntent Err: " + ex.Message, ToastLength.Long); } // mati bhai } else if (SJMC.Helpers.Settings.NotificationKind == "SjmcNewsNotification") { /*string kkk = intent.GetStringExtra("SjmcNotificationId"); * SJMC.Helpers.Settings.OpenNewsNumber = Convert.ToInt32(kkk); * SJMC.Helpers.Settings.NewsNotificationOpen = true; * * FirebasePushNotificationManager.ProcessIntent(this, intent);*/ SJMC.Helpers.Settings.NewsNotificationOpen = true; //App.Current.MainPage.Navigation.PushAsync(new SJMC.Views.HomeView(), true); } SJMC.Helpers.Settings.NotificationKind = ""; //base.DidReceiveNotificationResponse(center, response, completionHandler); } } catch (Exception ex) { } }
public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) { Console.WriteLine(userInfo.ToString()); }
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action <UIBackgroundFetchResult> completionHandler) { Console.WriteLine("PushData received " + userInfo.ToString()); ProcessNotification(userInfo); completionHandler(UIBackgroundFetchResult.NewData); }
public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context) { var path = keyPath.ToString(); System.Diagnostics.Debug.WriteLine(string.Format("*** AudioService.ObserveValue - Value change: {0} = {1}", keyPath, change.ToString())); if (path.Equals(_status)) { if (_Player.Status == AVPlayerStatus.ReadyToPlay) { if (!PlayerReady) { PlayerReady = _PlayerItem.Duration != CMTime.Indefinite; if (PlayerReady) { PlaybackStatus?.Invoke(this, new PlaybackEventArgs { CurrentTime = 0, Duration = _PlayerItem.Duration.Seconds, Stopped = true, IsNew = true }); PlayerStatus?.Invoke(this, new EventArgs()); } } } } else if (path.Equals(_error)) { if (_Player.Error != null) { PlayerReady = false; PlaybackStatus?.Invoke(this, new PlaybackEventArgs { CurrentTime = 0, Duration = 0, Stopped = true, HasError = true }); PlayerStatus?.Invoke(this, new EventArgs()); } } }