// Called from the native SDK - Called when a push notification received. public void OnPushNotificationReceived(OSNotification notification) { if (builder._notificationReceivedDelegate != null) { builder._notificationReceivedDelegate(notification); } }
private static void HandleNotificationReceived(OSNotification notification) { try { OSNotificationPayload payload = notification.payload; Dictionary <string, object> additionalData = payload.additionalData; string message = payload.body; } catch (Exception ex) { var exception = ex.ToString(); } }
private static void HandleNotificationReceived(OSNotification notification) { try { OSNotificationPayload payload = notification.payload; Dictionary <string, object> additionalData = payload.additionalData; string message = payload.body; } catch (Exception ex) { Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Long).Show(); //Allen Console.WriteLine(ex); } }
private static void HandleNotificationReceived(OSNotification notification) { try { //OSNotificationPayload payload = notification.payload; //Dictionary<string, object> additionalData = payload.additionalData; //string message = payload.body; } catch (Exception ex) { Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Long)?.Show(); //Allen Methods.DisplayReportResultTrack(ex); } }
private static void HandleNotificationReceived(OSNotification notification) { try { OSNotificationPayload payload = notification.payload; Dictionary <string, object> additionalData = payload.additionalData; Console.WriteLine(additionalData); //string message = payload.body; } catch (Exception e) { Console.WriteLine(e); } }
private static void HandleNotificationReceived(OSNotification notification) { try { OSNotificationPayload payload = notification.payload; //Dictionary<string, object> additionalData = payload.additionalData; string message = payload.body; if (message.Contains("call") || message.Contains("Calling")) { notification.shown = false; notification.displayType = OSNotification.DisplayType.None; OneSignal.Current.ClearAndroidOneSignalNotifications(); } } catch (Exception ex) { Console.WriteLine(ex); } }
private OSNotification OSNotificationToXam(iOS.OSNotification notif) { var notification = new OSNotification(); notification.displayType = (OSNotification.DisplayType)notif.DisplayType; notification.shown = notif.Shown; notification.silentNotification = notif.SilentNotification; notification.isAppInFocus = notif.IsAppInFocus; notification.payload = new OSNotificationPayload(); notification.payload.actionButtons = new List <Dictionary <string, object> >(); if (notif.Payload.ActionButtons != null) { for (int i = 0; i < (int)notif.Payload.ActionButtons.Count; ++i) { NSDictionary element = notif.Payload.ActionButtons.GetItem <NSDictionary>((uint)i); notification.payload.actionButtons.Add(NSDictToPureDict(element)); } } notification.payload.additionalData = new Dictionary <string, object>(); if (notif.Payload.AdditionalData != null) { foreach (KeyValuePair <NSObject, NSObject> element in notif.Payload.AdditionalData) { notification.payload.additionalData.Add((NSString)element.Key, element.Value); } } notification.payload.badge = (int)notif.Payload.Badge; notification.payload.body = notif.Payload.Body; notification.payload.contentAvailable = notif.Payload.ContentAvailable; notification.payload.launchURL = notif.Payload.LaunchURL; notification.payload.notificationID = notif.Payload.NotificationID; notification.payload.sound = notif.Payload.Sound; notification.payload.subtitle = notif.Payload.Subtitle; notification.payload.title = notif.Payload.Title; return(notification); }
private static void HandleNotificationReceived(OSNotification notification) { try { OSNotificationPayload payload = notification.payload; //Dictionary<string, object> additionalData = payload.additionalData; string message = payload.body; if (message.Contains("call") || message.Contains("Calling")) { notification.shown = false; notification.displayType = OSNotification.DisplayType.None; Com.OneSignal.OneSignal.Current.ClearAndroidOneSignalNotifications(); } } catch (Exception ex) { Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Long)?.Show(); //Allen Methods.DisplayReportResultTrack(ex); } }
private static void HandleNotificationReceived(OSNotification notification) { try { OSNotificationPayload payload = notification.payload; Dictionary <string, object> additionalData = payload.additionalData; //if (Settings.Enable_Audio_Video_Call) //{ // if (additionalData.ContainsKey("room_name") && Settings.Use_Agora_Library) // { // string room_name = additionalData["room_name"].ToString(); // string Call_type = additionalData["call_type"].ToString(); // string Call_id = additionalData["call_id"].ToString(); // string From_id = additionalData["from_id"].ToString(); // string to_id = additionalData["to_id"].ToString(); // Toast.MakeText(Application.Context, "GotNotification", ToastLength.Long).Show(); // var datauser = Classes.UserList.FirstOrDefault(a => a.user_id == From_id); // if (datauser != null) // { // string AvatarSplit = datauser.profile_picture.Split('/').Last(); // var GetImg = IMethods.MultiMedia.GetMediaFrom_Disk("Images", AvatarSplit); // if (datauser.profile_picture != null) // { // if (GetImg == "File Dont Exists") // IMethods.MultiMedia.DownloadMediaTo_DiskAsync("Images", datauser.profile_picture); // GetImg = datauser.profile_picture; // } // Intent intent = new Intent(Application.Context, typeof(AgoraAudioCallActivity)); // if (Call_type == "audio") // { // intent.PutExtra("UserID", From_id); // intent.PutExtra("avatar", GetImg); // intent.PutExtra("name", datauser.profile_picture); // intent.PutExtra("CallID", Call_id); // intent.PutExtra("room_name", room_name); // intent.PutExtra("type", "Agora_audio_call_recieve"); // NotificationManagerClass.StartinCommingCall(intent, GetImg, "Voice Call", datauser.name + " is calling you", notification.androidNotificationId); //Allen // } // else // { // intent = new Intent(Application.Context, typeof(AgoraVideoCallActivity)); // intent.PutExtra("UserID", From_id); // intent.PutExtra("avatar", GetImg); // intent.PutExtra("name", datauser.profile_picture); // intent.PutExtra("CallID", Call_id); // intent.PutExtra("room_name", room_name); // intent.PutExtra("type", "Agora_video_call_recieve"); // NotificationManagerClass.StartinCommingCall(intent, GetImg, "Video Call", datauser.name + " is calling you", notification.androidNotificationId); //Allen // } // } // else // { // } // } // else if (additionalData.ContainsKey("access_token") && Settings.Use_Twilio_Library) // { // } //} string message = payload.body; } catch (Exception ex) { Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Long).Show(); //Allen Console.WriteLine(ex); } }
private static void HandleNotificationReceived(OSNotification notification) { try { OSNotificationPayload payload = notification.payload; Dictionary <string, object> additionalData = payload.additionalData; if (additionalData?.Count > 0) { string chatType = "", IdChat = ""; foreach (var item in additionalData) { switch (item.Key) { case "post_id": PostId = item.Value.ToString(); break; case "user_id": UserId = item.Value.ToString(); chatType = "user"; IdChat = UserId; break; case "page_id": PageId = item.Value.ToString(); chatType = "page"; IdChat = PageId + UserId; break; case "group_id": GroupId = item.Value.ToString(); chatType = "group"; IdChat = GroupId; break; case "event_id": EventId = item.Value.ToString(); break; case "type": Type = item.Value.ToString(); break; } } if (!string.IsNullOrEmpty(IdChat)) { if (ListUtils.MuteList.Count == 0) { var sqLiteDatabase = new SqLiteDatabase(); ListUtils.MuteList = sqLiteDatabase.Get_MuteList(); } var check = ListUtils.MuteList.FirstOrDefault(a => a.IdChat == IdChat && a.ChatType == chatType); if (check != null) { notification.shown = false; notification.displayType = OSNotification.DisplayType.None; Com.OneSignal.OneSignal.Current.ClearAndroidOneSignalNotifications(); } } } string message = payload.body; if (message.Contains("call") || message.Contains("Calling")) { notification.shown = false; notification.displayType = OSNotification.DisplayType.None; Com.OneSignal.OneSignal.Current.ClearAndroidOneSignalNotifications(); } } catch (Exception ex) { Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Long)?.Show(); //Allen Methods.DisplayReportResultTrack(ex); } }