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
![www.b4x.com](/android/forum/proxy.php?image=https%3A%2F%2Fwww.b4x.com%2Fandroid%2Fforum%2Ffavicon-32x32.png&hash=bcf22ccc379ea83798b29b214de4d482&return_error=1)
This is an addition to the UserNotificationCenter class.
Remove all delivered notifications
![developer.apple.com](/android/forum/proxy.php?image=https%3A%2F%2Fdocs.developer.apple.com%2Ftutorials%2Fdeveloper-og.jpg&hash=4e3d83468fd4a93fccdc63899c26f349&return_error=1)
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
![developer.apple.com](/android/forum/proxy.php?image=https%3A%2F%2Fdocs.developer.apple.com%2Ftutorials%2Fdeveloper-og.jpg&hash=4e3d83468fd4a93fccdc63899c26f349&return_error=1)
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"))