iOS Code Snippet UserNotificationCenter class - Remove delivered notifications


This is an addition to the UserNotificationCenter class.

Remove all delivered notifications

"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

"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"))
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…