PushNotifications
public class PushNotifications
Used to send Push notifications via a IBM Cloud Push Notifications service.
-
The IBM Cloud region where the Push Notifications service is hosted.
Declaration
Swift
public struct Region -
Initialize PushNotifications by supplying the information needed to connect to the IBM Cloud Push Notifications service.
Declaration
Swift
public init(pushRegion: String, pushAppGuid: String, pushAppSecret: String)Parameters
pushRegionThe IBM Cloud region where the Push Notifications service is hosted.
pushAppGuidThe app GUID for the IBM Cloud application that the Push Notifications service is bound to.
pushAppSecretThe appSecret credential required for Push Notifications service authorization.
-
Initialize PushNotifications by supplying the information needed to connect to the IBM Cloud Push Notifications service.
Declaration
Swift
public init(pushApiKey: String, pushAppGuid: String, pushRegion: String)Parameters
pushRegionThe IBM Cloud region where the Push Notifications service is hosted.
pushAppGuidThe app GUID for the IBM Cloud application that the Push Notifications service is bound to.
pushApiKeyThe ApiKey credential required for Push Notifications service authorization.
-
This method will get an iam auth token from the server and add it to the request header. Get Auth token before calling any send methods.
Declaration
Swift
public func getAuthToken(completionHandler: @escaping (_ hasToken: Bool?, _ tokenValue: String) -> Void)Parameters
completionHandlerReturns true if there is token with token string
-
Send the Push notification.
- paramter completionHandler: The callback to be executed when the send request completes.
Declaration
Swift
public func send(notification: Notification, completionHandler: PushNotificationsCompletionHandler?)Parameters
notificiationThe push notification to send.
-
Send Bulk Push notification.
- paramter completionHandler: The callback to be executed when the send request completes.
Declaration
Swift
public func sendBulk(notification: [Notification], completionHandler: PushNotificationsCompletionHandler?)Parameters
notificiationArray of push notification payload to send.
View on GitHub
PushNotifications Class Reference