UserNotificationCenter class
A class that creates local notifications based on the newer iOS 10+ API. The notifications are configured to show even when the app is in the foreground. You can also add actions to the notifications: See the attached example
This is an addition to the UserNotificationCenter class.
Remove all delivered notifications
removeAllDeliveredNotifications() | Apple Developer Documentation
Removes all of your app’s delivered notifications from Notification Center.
"Use this method to remove all of your app’s delivered notifications from Notification Center. The method executes asynchronously, returning immediately and removing the identifiers on a background thread. This method does not affect any notification requests that are scheduled, but have not yet been delivered."
B4X:
'Removes all of your app’s delivered notifications from Notification Center.
Public Sub RemoveAllDeliveredNotifications
Try
NotificationCenter.RunMethod("removeAllDeliveredNotifications", Null)
Catch
Log(LastException)
End Try
End Sub
Usage:
noti.RemoveAllDeliveredNotifications
Remove delivered notifications with the specified identifiers
removeDeliveredNotifications(withIdentifiers:) | Apple Developer Documentation
Removes your app’s notifications from Notification Center that match the specified identifiers.
"Use this method to selectively remove notifications that you no longer want displayed in Notification Center. The method executes asynchronously, returning immediately and removing the specified notifications on a background thread."
B4X:
'Removes your app’s notifications from Notification Center that match the specified identifiers.
Public Sub RemoveDeliveredNotifications (Identifiers As List)
Try
NotificationCenter.RunMethod("removeDeliveredNotificationsWithIdentifiers:", Array(Identifiers))
Catch
Log(LastException)
End Try
End Sub
Usage:
noti.RemoveDeliveredNotifications(Array As String("YourIdentifer1","YourIdentifer2"))