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
pushRegion
The IBM Cloud region where the Push Notifications service is hosted.
pushAppGuid
The app GUID for the IBM Cloud application that the Push Notifications service is bound to.
pushAppSecret
The 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
pushRegion
The IBM Cloud region where the Push Notifications service is hosted.
pushAppGuid
The app GUID for the IBM Cloud application that the Push Notifications service is bound to.
pushApiKey
The 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
completionHandler
Returns 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
notificiation
The 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
notificiation
Array of push notification payload to send.