//No se puede implementar. :/ private void GetRemoteInput(StatusBarNotification sbn) { RemoteInput remoteInput; if (sbn.Notification.Actions != null) { foreach (var item in sbn.Notification.Actions) { List <RemoteInput> remoteInputs; if (item.GetRemoteInputs() != null) { remoteInputs = item.GetRemoteInputs().ToList(); foreach (var remoteinput in remoteInputs) { if (remoteinput.ResultKey != null) { remoteInput = remoteinput; remoteInput.Extras.PutCharSequence(remoteinput.ResultKey, ":)"); item.Extras.PutCharSequence(remoteinput.ResultKey, ":)"); item.ActionIntent.Send(); var i = item.ActionIntent; break; } } } } } }
public void OnNotificationRemoved(StatusBarNotification sbn) { int position = GetNotificationPosition(sbn); if (position >= 0) { StatusBarNotifications.RemoveAt(position); using (var h = new Handler(Looper.MainLooper)) h.Post(() => { //When removing a summary notification it causes a IndexOutOfBoundsException... //notificationAdapter.NotifyItemRemoved(position); //This has to be fixed, anyway, because this change makes the adapter to lose the animations when removing a item notificationAdapter.NotifyDataSetChanged(); }); } if (StatusBarNotifications.Count == 0) { OnNotificationListSizeChanged(new NotificationListSizeChangedEventArgs { ThereAreNotifications = false }); } OnNotificationRemoved(); }
public override void OnNotificationPosted(StatusBarNotification sbn) { lastPostedNotification = sbn; catcherHelper.OnNotificationPosted(new OpenNotification(sbn)); //var test1 = sbn.Notification.Extras.GetString(Notification.ExtraTemplate); //var test2 = sbn.Notification.Extras; //var test3 = sbn.Notification.Flags; //var test4 = sbn.Notification.Extras.GetCharSequence(Notification.ExtraSummaryText); //var test5 = sbn.Notification.Extras.GetCharSequenceArray(Notification.ExtraTextLines); //var test6 = sbn.Notification.Extras.Get("android.wearable.EXTENSIONS"); //var test7 = sbn.Notification.Extras.KeySet(); //var test8 = sbn.Notification.Extras.Get("android.people.list"); //var test10 = sbn.Notification.Extras.Get("android.messagingUser"); //var test11 = sbn.Notification.Extras.Get("android.messagingStyleUser"); //var test12 = sbn.Notification.Extras.Get("android.messages"); //var test13 = sbn.Notification.Extras.GetParcelableArray("android.messages"); //var test15 = (NotificationPriority)sbn.Notification.Priority; //foreach (Bundle item in test13) //{ // var test14 = item.KeySet(); // var moreExtras = item.Get("extras"); // var sender_person = item.Get("sender_person"); // var sender = item.Get("sender"); // var text = item.Get("text"); // var time = item.Get("time"); //} }
private void OnItemClicked(int position, StatusBarNotification sbn) { ItemClicked?.Invoke(this, new NotificationItemClickedEventArgs { Position = position, StatusBarNotification = sbn }); }
public void OnNotificationPosted(StatusBarNotification sbn) { //This is the notification of 'LiveDisplay is showing above other apps' //Simply let's ignore it, because it's annoying. (Anyway, the user couldn't care less about this notification tbh) if (sbn.PackageName == "android" && sbn.Tag == "com.android.server.wm.AlertWindowNotification - com.underground.livedisplay") { return; } var blockingstatus = Blacklist.ReturnBlockLevel(sbn.PackageName); if (!blockingstatus.HasFlag(LevelsOfAppBlocking.Blacklisted)) { if (!blockingstatus.HasFlag(LevelsOfAppBlocking.BlockInAppOnly)) { int index = GetNotificationPosition(sbn); //Tries to get the index of a possible already existing notification in the list of notif. if (index >= 0) { //It exists within the list. //SO it should be updated. StatusBarNotifications.RemoveAt(index); StatusBarNotifications.Add(sbn); using (var h = new Handler(Looper.MainLooper)) h.Post(() => { notificationAdapter.NotifyItemChanged(index); }); OnNotificationPosted(blockingstatus.HasFlag(LevelsOfAppBlocking.None), sbn, true); } else { StatusBarNotifications.Add(sbn); using (var h = new Handler(Looper.MainLooper)) h.Post(() => { notificationAdapter.NotifyItemInserted(StatusBarNotifications.Count); }); OnNotificationPosted(blockingstatus.HasFlag(LevelsOfAppBlocking.None), sbn, false); } } } else { var notificationSlave = NotificationSlave.NotificationSlaveInstance(); if (Build.VERSION.SdkInt > BuildVersionCodes.KitkatWatch) { notificationSlave.CancelNotification(sbn.Key); } else { notificationSlave.CancelNotification(sbn.PackageName, sbn.Tag, sbn.Id); } } if (StatusBarNotifications.Count > 0) { OnNotificationListSizeChanged(new NotificationListSizeChangedEventArgs { ThereAreNotifications = true }); } }
private void OnNotificationPosted(bool shouldCauseWakeup, StatusBarNotification sbn, bool updatesPreviousNotification) { NotificationPosted?.Invoke(this, new NotificationPostedEventArgs() { ShouldCauseWakeUp = shouldCauseWakeup, StatusBarNotification = sbn, UpdatesPreviousNotification = updatesPreviousNotification }); }
public override void OnNotificationPosted(StatusBarNotification sbn) { base.OnNotificationPosted(sbn); if (sbn.PackageName == "com.facepunch.rust.companion") { var txt = sbn.Notification.Extras.GetString("android.title") + "\n" + sbn.Notification.Extras.GetString("android.text"); var post = new Post(txt); post.CallWebhook().Wait(); } }
private void ShowStatus(string style, string message) { if (autoDismiss) { StatusBarNotification.Show(message, DismissalDelay, style); } else { StatusBarNotification.Show(message, style); } }
public override void OnNotificationPosted(StatusBarNotification sbn) { base.OnNotificationPosted(sbn); string pack = sbn.PackageName; string ticker = sbn.Notification.TickerText?.ToString(); Bundle extras = sbn.Notification.Extras; string title = extras.GetString("android.title"); string text = extras.GetCharSequence("android.text")?.ToString(); if (pack.Equals("com.google.android.gms")) { logger.Info($"pack: {pack} | ticker: {ticker} | title: {title} | text: {text}"); logger.Info(sbn.Notification.ToString()); if (ticker.Equals("View your refund") || ticker.Equals("View your purchase")) { var value = this.GetGooglePayValue(text); var bundle = new List <BundleItem> { new BundleItem { Key = PropertyKeys.ADD_TRANSACTION_TITLE, Type = BundleItemType.String, Object = title }, // ticker: View your refund | text: PLN22.01 was refunded to Mastercard •••• 9901 new BundleItem { Key = PropertyKeys.REDIRECT_TO, Type = BundleItemType.Int, Object = ActivityPage.AddTransaction }, // ticker: View your purchase | title: jakdojade.pl | text: PLN3.40 with Mastercard •••• 9901 new BundleItem { Key = PropertyKeys.ADD_TRANSACTION_VALUE, Type = BundleItemType.String, Object = value }, }; notificationService.ShowNotification("New Google Pay Transaction", $"Add {value} from {title}", bundle); } } if (pack.Equals("com.revolut.revolut")) { logger.Info($"pack: {pack} | ticker: {ticker} | title: {title} | text: {text}"); logger.Info(sbn.Notification.ToString()); var value = this.GetRevolutValue(text); var revolutTitle = this.GetRevolutTitle(text); var bundle = new List <BundleItem> { new BundleItem { Key = PropertyKeys.ADD_TRANSACTION_TITLE, Type = BundleItemType.String, Object = revolutTitle }, //text: 💳 Paid €10 at The Circus Hostel new BundleItem { Key = PropertyKeys.REDIRECT_TO, Type = BundleItemType.Int, Object = ActivityPage.AddTransaction }, //text: 💳 Paid €3.88 at McDonald's new BundleItem { Key = PropertyKeys.ADD_TRANSACTION_VALUE, Type = BundleItemType.String, Object = value }, //text: 💳 Paid €20.70 at Transit }; notificationService.ShowNotification("New Revolut Transaction", $"Add {value} from {revolutTitle}", bundle); } }
private void LogStausBarNotification(StatusBarNotification sbn) { Log.Info(TAG, string.Format("[StatusBarNotification] GroupKey: {0}, Id: {1}, Key: {2}, Notification: {3}, PackageName: {4}, Tag: {5}, ToString: {6}", "Unavailable (API)", sbn.Id, "Unavailable (API)", sbn.Notification, sbn.PackageName, sbn.Tag, sbn.ToString())); }
public override void OnNotificationPosted(StatusBarNotification sbn) { string packageName = sbn.PackageName; string content = sbn.Notification.TickerText.ToString(); System.Diagnostics.Debug.WriteLine(packageName); System.Diagnostics.Debug.WriteLine(content); System.Diagnostics.Debug.WriteLine("Nowa notyfikacja "); base.OnNotificationPosted(sbn); Toast.MakeText(Application.Context, "The notification was posted", ToastLength.Short).Show(); //System.Diagnostics.Debug.WriteLine("Nowa notyfikacja "); }
public override void OnNotificationRemoved(StatusBarNotification sbn) { int indice = listaNotificaciones.IndexOf(listaNotificaciones.FirstOrDefault(o => o.Id == sbn.Id)); if (indice >= 0) { listaNotificaciones.RemoveAt(indice); } if (adapter != null && LockScreenActivity.lockScreenInstance != null) { LockScreenActivity.lockScreenInstance.RunOnUiThread(() => adapter.NotifyItemRemoved(indice)); Log.Info("Remoción, tamaño lista: ", listaNotificaciones.Count.ToString()); } }
private void RetrieveNotificationFromStatusBar() { statusBarNotifications = new List <StatusBarNotification>(); foreach (var notification in GetActiveNotifications()?.ToList()) { //var test6 = notification.Notification.Extras.Get(Notification.ExtraMediaSession) as MediaSession.Token; //if (test6 != null) //{ // MediaController mediaController = new MediaController(this, test6); // mediaController.RegisterCallback(MusicController.GetInstance()); //} //var test1 = notification.Notification.Extras.GetString(Notification.ExtraTemplate); //var test2 = notification.Notification.Extras; //var test3 = notification.Notification.Flags; //var test4 = notification.Notification.Extras.GetCharSequence(Notification.ExtraSummaryText); //var test5 = notification.Notification.Extras.GetCharSequenceArray(Notification.ExtraTextLines); //var test6 = notification.Notification.Extras.Get("android.wearable.EXTENSIONS"); //var test7 = notification.Notification.Extras.KeySet(); //var test8 = notification.Notification.Extras.Get("android.people.list"); //var test10= notification.Notification.Extras.Get("android.messagingUser"); //var test11= notification.Notification.Extras.Get("android.messagingStyleUser"); //var test12= notification.Notification.Extras.Get("android.messages"); //var test13 = notification.Notification.Extras.GetParcelableArray("android.messages"); //if(test13 != null) //foreach (Bundle item in test13) //{ // var test14 = item.KeySet(); // var moreExtras = item.Get("extras"); // var sender_person = item.Get("sender_person"); // var sender = item.Get("sender"); // var text = item.Get("text"); // var time = item.Get("time"); // var uri = item.Get("uri"); // var type = item.Get("type"); //} if (notification.Notification.Flags.HasFlag(NotificationFlags.GroupSummary) == false) //Don't grab summary notifications yet. hotfix. { statusBarNotifications.Add(notification); lastPostedNotification = notification; } } catcherHelper = new CatcherHelper(statusBarNotifications); }
public void OnNotificationPosted(StatusBarNotification sbn) { if (!UpdateNotification(sbn)) { InsertNotification(sbn); } if (statusBarNotifications.Count > 0) { OnNotificationListSizeChanged(new NotificationListSizeChangedEventArgs { ThereAreNotifications = true }); thereAreNotifications = true; } }
private bool UpdateNotification(StatusBarNotification sbn) { int indice = GetNotificationPosition(sbn); if (indice >= 0 /*&& Blacklist.IsAppBlacklisted(sbn.PackageName) == false*/) { statusBarNotifications.RemoveAt(indice); statusBarNotifications.Add(sbn); using (var h = new Handler(Looper.MainLooper)) h.Post(() => { notificationAdapter.NotifyItemChanged(indice); }); OnNotificationUpdated(indice); return(true); } return(false); }
private void StartTimer() { var progress = 0.0f; timer = NSTimer.CreateRepeatingScheduledTimer(ProgressInterval, t => { if (progress < 1.0) { progress += ProgressStep; StatusBarNotification.ShowProgress(progress); } else { Invoke(() => StatusBarNotification.ShowProgress(0.0f), 1.0); t.Invalidate(); } }); }
private bool TryGetTsumTsumHeartSender(StatusBarNotification sbn, out string senderName) { if (sbn.Notification != null && sbn.Notification.Extras != null) { string notificationText = sbn.Notification.Extras.GetCharSequence("android.text").ToString(); if (!string.IsNullOrEmpty(notificationText)) { senderName = notificationText.Substring(0, notificationText.IndexOf(" send you a Heart as a gift!")); return(true); } else { Log.Error(TAG, "No text found for the current notification!"); } } senderName = "Unknown"; return(false); }
public void OnNotificationRemoved(StatusBarNotification sbn) { int position = GetNotificationPosition(sbn); if (position >= 0) { statusBarNotifications.RemoveAt(position); using (var h = new Handler(Looper.MainLooper)) h.Post(() => { notificationAdapter.NotifyItemRemoved(position); }); } if (statusBarNotifications.Count == 0) { OnNotificationListSizeChanged(new NotificationListSizeChangedEventArgs { ThereAreNotifications = false }); thereAreNotifications = false; } }
public override void OnNotificationPosted(StatusBarNotification sbn) { if (Build.VERSION.SdkInt >= BuildVersionCodes.O) { //Let's attach the NotificationChannels that this package represents to this StatusbarNotification try { var channels = GetNotificationChannels(sbn.PackageName, sbn.User); } catch (Exception ex) { Log.Info("LiveDisplay", "Oops!: " + ex.Message); } } catcherHelper.OnNotificationPosted(sbn); //var test6 = sbn.Notification.Extras.Get(Notification.ExtraMediaSession) as MediaSession.Token; //if (test6 != null) //{ // try // { // MediaController mediaController = new MediaController(this, test6); // var musicController = MusicController.GetInstance(); // mediaController.RegisterCallback(musicController); // //Retrieve the controls to control the media, duh. // musicController.TransportControls = mediaController.GetTransportControls(); // musicController.MediaMetadata = mediaController.Metadata; // musicController.PlaybackState = mediaController.PlaybackState; // } // catch // { // //mediaController?.UnregisterCallback(musicController); // //musicController.Dispose(); // } // //mediaController.RegisterCallback(MusicController.GetInstance()); //} }
public override async void OnNotificationPosted(StatusBarNotification sbn) { base.OnNotificationPosted(sbn); if (!prefs.GetBoolean("detect_song", true)) { return; } if (sbn.Notification?.Category != "transport") { return; } Song notificationSong = GetTitleAndArtistFromExtras(sbn.Notification.Extras?.ToString()); if (previousSong.Title != notificationSong.Title && !string.IsNullOrEmpty(notificationSong.Title)) { Log(Type.Event, "Previous song is different and not empty, getting search results..."); await GetAndCompareResults(notificationSong); } }
private void InsertNotification(StatusBarNotification sbn) { //if (Blacklist.IsAppBlacklisted(sbn.PackageName) == false) //{ statusBarNotifications.Add(sbn); using (var h = new Handler(Looper.MainLooper)) h.Post(() => { notificationAdapter.NotifyItemInserted(statusBarNotifications.Count); }); OnNotificationPosted(); //} //else //{ // var notificationSlave = NotificationSlave.NotificationSlaveInstance(); // if (Build.VERSION.SdkInt > BuildVersionCodes.KitkatWatch) // { // notificationSlave.CancelNotification(sbn.Key); // } // else // { // notificationSlave.CancelNotification(sbn.PackageName, sbn.Tag, sbn.Id); // } //} }
public override void OnNotificationPosted(StatusBarNotification sbn) { //Kitkat Dirty ListenerConnected. //No funciona si no hay una notificación nueva if (Build.VERSION.SdkInt < BuildVersionCodes.Lollipop && isConnected == false) { catcherInstance = this; listaNotificaciones = GetActiveNotifications().ToList(); adapter = new NotificationAdapter(listaNotificaciones); isConnected = true; Log.Info("Kitkat Listener connected, list: ", listaNotificaciones.Count.ToString()); } int id = sbn.Id; int indice = listaNotificaciones.IndexOf(listaNotificaciones.FirstOrDefault(o => o.Id == sbn.Id)); //Condicional debido a que Play Store causa que algun item se pierda #wontfix ? if (indice >= 0) { listaNotificaciones.RemoveAt(indice); listaNotificaciones.Add(sbn); if (LockScreenActivity.lockScreenInstance != null) { LockScreenActivity.lockScreenInstance.RunOnUiThread(() => adapter.NotifyItemChanged(indice)); } Log.Info("Elemento actualizado", "Tamaño lista: " + listaNotificaciones.Count); } else { listaNotificaciones.Add(sbn); if (LockScreenActivity.lockScreenInstance != null) { LockScreenActivity.lockScreenInstance.RunOnUiThread(() => adapter.NotifyItemInserted(listaNotificaciones.Count)); } Log.Info("Elemento insertado", "Tamaño lista: " + listaNotificaciones.Count); } }
public override void ViewDidLoad() { base.ViewDidLoad(); // presenting a notification, before a keyWindow is set StatusBarNotification.Show("Hello World!", 2.0, StatusBarStyles.Matrix); // create custom styles StatusBarNotification.AddStyle(CustomStyle1, style => { style.BarColor = new UIColor(0.797f, 0.000f, 0.662f, 1.000f); style.TextColor = UIColor.White; style.AnimationType = StatusBarAnimationType.Fade; style.Font = UIFont.FromName("SnellRoundhand-Bold", 17.0f); style.ProgressBarColor = new UIColor(0.986f, 0.062f, 0.598f, 1.000f); style.ProgressBarHeight = 20.0f; return(style); }); StatusBarNotification.AddStyle(CustomStyle2, style => { style.BarColor = UIColor.Cyan; style.TextColor = new UIColor(0.056f, 0.478f, 0.478f, 1.000f); style.AnimationType = StatusBarAnimationType.Bounce; style.ProgressBarColor = style.TextColor; style.ProgressBarHeight = 5.0f; style.ProgressBarPosition = StatusBarProgressBarPosition.Top; if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0)) { style.Font = UIFont.FromName("DINCondensed-Bold", 17.0f); style.TextVerticalPositionAdjustment = 2.0f; } else { style.Font = UIFont.FromName("HelveticaNeue-CondensedBold", 17.0f); } return(style); }); }
public override void OnNotificationPosted(StatusBarNotification sbn) { sbnList.Enqueue(sbn.PackageName); while (sbnList.Count > 0) { string name = sbnList.Dequeue(); string cmd = "255,255,255,100\n"; if (name.Contains("textra")) { cmd = "0,0,255,200\n"; } else if (name.Contains("outlook")) { cmd = "255,165,0,200\n"; } else if (name.Contains("signal")) { cmd = "255,0,0,200\n"; } else if (name.Contains("slack")) { cmd = "0,255,0,200\n"; } UTF8Encoding encoding = new System.Text.UTF8Encoding(); byte[] buffer = encoding.GetBytes(cmd); d.WriteCharacteristic(new Guid("0000dfb0-0000-1000-8000-00805f9b34fb"), new Guid("0000dfb1-0000-1000-8000-00805f9b34fb"), buffer).Subscribe( result => Console.WriteLine(result) ); } base.OnNotificationPosted(sbn); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { tableView.DeselectRow(indexPath, true); // cancel progress if we are going to show new or dismiss old if (indexPath.Section != 0 || indexPath.Row == 2) { CancelTimer(); } if (indexPath.Section == 0) { // current notification controls if (indexPath.Row == 0) { // show progress if (!StatusBarNotification.IsVisible) { indicatorStyle = UIActivityIndicatorViewStyle.Gray; ShowStatus(StatusBarStyles.Default, "Some Progress..."); } StartTimer(); } else if (indexPath.Row == 1) { // show activity if (!StatusBarNotification.IsVisible) { indicatorStyle = UIActivityIndicatorViewStyle.Gray; ShowStatus(StatusBarStyles.Default, "Some Activity..."); } StatusBarNotification.ShowActivityIndicator(true, indicatorStyle); } else if (indexPath.Row == 2) { // dismiss StatusBarNotification.Dismiss(true); } else if (indexPath.Row == 3) { // auto dismiss autoDismiss = !autoDismiss; var cell = tableView.CellAt(indexPath); cell.Accessory = autoDismiss ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None; } } else if (indexPath.Section == 1) { // default notification styles indicatorStyle = UIActivityIndicatorViewStyle.Gray; var style = StatusBarStyles.Default; var message = "Better call Saul!"; if (indexPath.Row == 0) { // default style } else if (indexPath.Row == 1) { // success style indicatorStyle = UIActivityIndicatorViewStyle.White; style = StatusBarStyles.Success; message = "That's how we roll!"; } else if (indexPath.Row == 2) { // error style indicatorStyle = UIActivityIndicatorViewStyle.White; style = StatusBarStyles.Error; message = "No, I don't have the money..."; } else if (indexPath.Row == 3) { // warning style indicatorStyle = UIActivityIndicatorViewStyle.Gray; style = StatusBarStyles.Warning; message = "You know who I am!"; } else if (indexPath.Row == 4) { // dark style indicatorStyle = UIActivityIndicatorViewStyle.White; style = StatusBarStyles.Dark; message = "Don't mess with me!"; } else if (indexPath.Row == 5) { // matrix style indicatorStyle = UIActivityIndicatorViewStyle.White; style = StatusBarStyles.Matrix; message = "Wake up Neo..."; } // show ShowStatus(style, message); } else if (indexPath.Section == 2) { // custom notification styles if (indexPath.Row == 0) { // custom style 1 indicatorStyle = UIActivityIndicatorViewStyle.White; ShowStatus(CustomStyle1, "Oh, I love it!"); } else if (indexPath.Row == 1) { // custom style 2 indicatorStyle = UIActivityIndicatorViewStyle.Gray; ShowStatus(CustomStyle2, "Level up!"); } } }
public override void OnNotificationRemoved(StatusBarNotification sbn) { catcherHelper.OnNotificationRemoved(sbn); }
public override void OnNotificationPosted(StatusBarNotification sbn) { #if __ANDROID_21__ // In previous versions this function was marked abstract, and thus the base call was not possible base.OnNotificationPosted(sbn); #endif Log.Info(TAG, "OnNotificationPosted"); if (IsTsumTsumNotification(sbn)) { string senderName; if (TryGetTsumTsumHeartSender(sbn, out senderName)) { Log.Info(TAG, $"Succesfully identified sender as \"{senderName}\""); TsumTsumSender sender = tsumTsumDatabaseManager.RetrieveOrCreateSenderByName(senderName); if (sender != null) { sender.HeartCount++; sender.LastReceiveTimestamp = DateTime.Now; tsumTsumDatabaseManager.UpdateOrInsertSender(sender); SendNotification(senderName, () => { Log.Info(TAG, $"Sender: {sender} send!"); }, () => { Log.Info(TAG, $"Sender: {sender} failed!"); }); // Send a broadcast, if the application is running it can pick up the broadcast message and update the view Intent intent = new Intent(this, Java.Lang.Class.FromType(typeof(TsumTsumNotifcationBroadcastReceiver))); //new Intent("nl.pleduc.TsumTsumHeartTracker"); intent.PutExtra("sender_database_updated", senderName); Android.Support.V4.Content.LocalBroadcastManager.GetInstance(this).SendBroadcast(intent); // If we have more than a set number of TsumTsum notifications, remove the oldest! StatusBarNotification[] sbns = GetActiveNotifications(); List <StatusBarNotification> tsumTsumNotificationList = new List <StatusBarNotification>(); for (int i = 0; i < sbns.Length; i++) { if (IsTsumTsumNotification(sbns[i])) { tsumTsumNotificationList.Add(sbns[i]); } } // Delete notifications in a FIFO way Log.Info(TAG, $"Notification count {tsumTsumNotificationList.Count}"); if (tsumTsumNotificationList.Count > 5) { tsumTsumNotificationList.Sort((a, b) => { return(b.Notification.When.CompareTo(a.Notification.When)); }); //Android.Support.V4.App.NotificationManagerCompat notificationManager = Android.Support.V4.App.NotificationManagerCompat.From(this); Log.Info(TAG, "Canceling Notification(s)"); while (tsumTsumNotificationList.Count > 5) { int idxToRemove = tsumTsumNotificationList.Count - 1; StatusBarNotification notificationToRemove = tsumTsumNotificationList[idxToRemove]; CancelNotification(notificationToRemove.PackageName, notificationToRemove.Tag, notificationToRemove.Id); //CancelNotification(notificationToRemove.Key); tsumTsumNotificationList.RemoveAt(idxToRemove); } } } } else { Log.Error(TAG, "Unable to extract the sender's name from the notification, possibly another type of TsumTsum notification!"); } } else { Log.Info(TAG, $"Not a {TargetAppName} notification, skipping it!"); } }
public override void OnNotificationRemoved(StatusBarNotification sbn) { base.OnNotificationRemoved(sbn); Toast.MakeText(Application.Context, "The notification was removed", ToastLength.Short).Show(); }
private bool IsTsumTsumNotification(StatusBarNotification sbn) { return(sbn.PackageName == TargetPackageName && (sbn.Notification != null && sbn.Notification.Extras != null && sbn.Notification.TickerText != null && sbn.Notification.TickerText.ToString() == TargetAppName)); }
public override void OnNotificationRemoved(StatusBarNotification sbn) { // Empty (deliberatly) }