PushNotificationsStatic
@objc
public final class PushNotificationsStatic : NSObject
A static equivalent of the PushNotifications
type.
-
Start PushNotifications service.
Precondition
instanceId
should not be nil.Declaration
Swift
@objc public static func start(instanceId: String)
Parameters
instanceId
PushNotifications instance id.
-
Register to receive remote notifications via Apple Push Notification service.
Convenience method is using
.alert
,.sound
, and.badge
as 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
options
A 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
userId
User id.
tokenProvider
Token provider that will be used to generate the token for the user that you want to authenticate.
completion
The 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
completion
The 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
completion
The block to execute after the device has been deleted from the server.
-
Register device token with PushNotifications service.
Precondition
deviceToken
should not be nil.Declaration
Swift
@objc public static func registerDeviceToken(_ deviceToken: Data)
Parameters
deviceToken
A token that identifies the device to APNs.
-
Subscribes the device to an interest.
Precondition
interest
should not be nil.Throws
An error of type
InvalidInterestError
Declaration
Swift
@objc public static func addDeviceInterest(interest: String) throws
Parameters
interest
Interest 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
interests
should not be nil.Throws
An error of type
MultipleInvalidInterestsError
Declaration
Swift
@objc public static func setDeviceInterests(interests: [String]) throws
Parameters
interests
Interests that you want to subscribe your device to.
-
Unsubscribe the device from an interest.
Precondition
interest
should not be nil.Throws
An error of type
InvalidInterestError
Declaration
Swift
@objc public static func removeDeviceInterest(interest: String) throws
Parameters
interest
Interest 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]) -> RemoteNotificationType
Parameters
userInfo
Remote Notification payload.