PushNotificationsStatic
@objc
public final class PushNotificationsStatic : NSObject
A static equivalent of the PushNotifications type.
-
Start PushNotifications service.
Precondition
instanceIdshould not be nil.Declaration
Swift
@objc public static func start(instanceId: String)Parameters
instanceIdPushNotifications instance id.
-
Register to receive remote notifications via Apple Push Notification service.
Convenience method is using
.alert,.sound, and.badgeas default authorization options.Declaration
Swift
@objc public static func registerForRemoteNotifications() -
Register to receive remote notifications via Apple Push Notification service.
-
Register to receive remote notifications via Apple Push Notification service.
Declaration
Swift
@objc public static func registerForRemoteNotifications(options: NSApplication.RemoteNotificationType)Parameters
optionsA bit mask specifying the types of notifications the app accepts. See NSApplication.RemoteNotificationType for valid bit-mask values.
-
Set user id.
Declaration
Swift
@objc public static func setUserId(_ userId: String, tokenProvider: TokenProvider, completion: @escaping (Error?) -> Void)Parameters
userIdUser id.
tokenProviderToken provider that will be used to generate the token for the user that you want to authenticate.
completionThe block to execute after attempt to set user id has been made.
-
Disable Beams service.
This will remove everything associated with the Beams from the device and Beams server.
Declaration
Swift
@objc public static func stop(completion: @escaping () -> Void)Parameters
completionThe block to execute after the device has been deleted from the server.
-
Clears all the state on the SDK leaving it in the empty started state.
This will remove the current user and all the interests associated with it from the device and Beams server. Device is now in a fresh state, ready for new subscriptions or user being set.
Declaration
Swift
@objc public static func clearAllState(completion: @escaping () -> Void)Parameters
completionThe block to execute after the device has been deleted from the server.
-
Register device token with PushNotifications service.
Precondition
deviceTokenshould not be nil.Declaration
Swift
@objc public static func registerDeviceToken(_ deviceToken: Data)Parameters
deviceTokenA token that identifies the device to APNs.
-
Subscribes the device to an interest.
Precondition
interestshould not be nil.Throws
An error of type
InvalidInterestErrorDeclaration
Swift
@objc public static func addDeviceInterest(interest: String) throwsParameters
interestInterest that you want to subscribe your device to.
-
Sets the subscriptions state for the device. Any interests not in the set will be unsubscribed from, so this will replace the interest set by the one provided.
Precondition
interestsshould not be nil.Throws
An error of type
MultipleInvalidInterestsErrorDeclaration
Swift
@objc public static func setDeviceInterests(interests: [String]) throwsParameters
interestsInterests that you want to subscribe your device to.
-
Unsubscribe the device from an interest.
Precondition
interestshould not be nil.Throws
An error of type
InvalidInterestErrorDeclaration
Swift
@objc public static func removeDeviceInterest(interest: String) throwsParameters
interestInterest that you want to unsubscribe your device from.
-
Unsubscribes the device from all the interests.
- Tag: clearDeviceInterests
Declaration
Swift
@objc public static func clearDeviceInterests() throws -
Get the interest subscriptions that the device is currently subscribed to.
Declaration
Swift
@objc public static func getDeviceInterests() -> [String]?Return Value
Array of interests
-
Handle Remote Notification.
Declaration
Swift
@discardableResult @objc public static func handleNotification(userInfo: [AnyHashable : Any]) -> RemoteNotificationTypeParameters
userInfoRemote Notification payload.
View on GitHub
PushNotificationsStatic Class Reference