Push notifications
Enable the application's Push Notifications capability and register with APNs through the application's notification flow. If the application needs silent notifications, enable Background Modes → Remote notifications as well.
The APNs token must also be registered with the SDK's Security Server after session establishment. SSCRemoteNotification.isAvailable reports whether remote notification registration is enabled for the server session.
APNs can deliver the device token before the SDK session opens. Keep the latest token and attempt registration when both the token and the session are available. Repeat registration when APNs supplies a new token and after subsequent session establishments.
@import SENSESmartContract;
// Call from the APNs callback and after successful SDK session establishment.
// deviceToken is the latest NSData received from APNs.
if ([SSCSessionService userLogged].length == 0 ||
![SSCRemoteNotification isAvailable]) {
// Defer registration until the session and server configuration allow it.
return;
}
NSError *error = nil;
BOOL registered = [SSCRemoteNotification registerRemoteNotificationToken:deviceToken
error:&error];
if (!registered) {
// Record the failure in application state and retry later.
// error may provide additional information.
}For Swift clients, the SDK also exposes SSCRemoteNotification.registerToken(_:), which returns a Bool without the NSError output parameter. Check the returned value to detect registration failure.
Notification delivery is managed by the operating system. Refresh pending work when the application resumes so that the signing flow can continue even if no push was delivered.