Push Notifications

Although it is up to the SDK integrator to configure their app for push notifications, to receive push notifications from the biid Identity Service, the device must first be registered with the service.

Register

To register a device to receive push notifications, the device token returned from the didRegisterForRemoteNotificationsWithDeviceToken callback method should be passed to the biid identity service as follows:

Swift3

    SDK.getClient.registerUserDevice(withDeviceToken: deviceToken,
        onSuccess: {
            // Handle successful registration
        }, onNoConnection: {
            // Handle no connection Error
        }, onInvalidToken: { (error) in
            // Handle invalid token error
        }, onClientError: { (error) in
            // Handle client error
    })  

ObjC

    [biidCoreSDK.getClient registerUserDeviceWithDeviceToken:deviceToken
        onSuccess:^{
            // Handle successful registration
        }
        onNoConnection:^void() {
            // Handle no connection Error
        }
        onInvalidToken:^void(NSError * _Nonnull error) {
            // Handle invalid token error
        }
        onClientError:^void(NSError * _Nonnull error) {
            // Handle client error
        }
    ];

Documentation

Unregister

It is also possible to opt out of receiving push notifications by unregistering the device as follows:

Swift3

    SDK.getClient.unregisterUserDevice (
        onSuccess: {
            // Handle successful "un-registration"
        }, onNoConnection: {
            // Handle no connection Error
        }, onInvalidToken: { (error) in
            // Handle invalid token error
        }, onClientError: { (error) in
            // Handle client error
    })  

ObjC

    [biidCoreSDK.getClient unregisterUserDeviceOnSuccess:^{
            // Handle successful "un-registration"
        }
        onNoConnection:^void() {
            // Handle no connection Error
        }
        onInvalidToken:^void(NSError * _Nonnull error) {
            // Handle invalid token error
        }
        onClientError:^void(NSError * _Nonnull error) {
            // Handle client error
        }
    ];

Documentation

Notification Handling

Although it is possible for the integrator app to parse incoming push notifications directly, it is highly recommended to use the SDK’s onPushNotificationReceived helper function to generate a BiidNotification object from the push notification’s userInfo payload.

The BiidNotification exposes the following information from the push notification’s userinfo dictionary:

BiidNotification Field Description
notificationTitle The title text of the notification payload
notificationDescription The description text of the notification payload
username Username of the User
entityURL Entity URL the user is linked to
transactionID TransactionID for auth & sign Notification Types (Optional)
type The type of the notification

The following type of notifications can be received:

AUTH Authentication Transaction
AUTH_WEB Web login transaction notification
AUTH_IDV Identity verification transaction notification
DOC Document Signing transaction notification
DOC_PDF PDF Document Signing transaction notification
DOC_XML XML Document Signing transaction notification
DOC_MIXED Mixed PDF & XML document signing transaction notification
MSG Message Only transaction notification
CERT Certification success notification
CERT_ERROR Certification error notification - something has gone wrong with the certification process

Swift3

    SDK.getClient.onPushNotificationReceived(userInfo, onSuccess: { (biidNotification) in
            switch biidNotification.type {
            case .auth:
                // Handle Notification
                break
            case .authWEB:
                // Handle Notification
                break
            case .authIDV:
                // Handle Notification
                break
            case .doc:
                // Handle Notification
                break
            case .docPDF:
                // Handle Notification
                break
            case .docXML:
                // Handle Notification
                break
            case .docMIXED:
                // Handle Notification
                break
            case .msg:
                // Handle Notification
                break
            case .cert:
                // Handle Notification
                break
            case .certError:
                // Handle Notification
                break
            default:
                // Either a malformed notification or not a biid notification
                // Parse the userInfo dictionary directly
                break
            }
    }) { (error) in
        // Handle client error
    }

ObjC

    [biidCoreSDK.getClient onPushNotificationReceivedWithUserInfo:userinfo
        onSuccess:^(BiidNotification * _Nonnull biidNotification) {
            // Handle notification
        }
        onClientError:^void(NSError * _Nonnull error) {
            // Handle client error
        }
     ];

Documentation