Contents
Handling events that happen with the SDK can allow for a richer UX experience for your end users. We recommend you handle each event (if applicable) that happen within each component of the library.
Before continuing, make sure you have read Integrating Push Notifications to allow for proper remote event handling involving the AuthenticatorManager
and AuthRequestManager
. Opting to skip this section will only allow for local events to trigger.
Many of our method calls are asynchronous events. As such, they should be handled appropriately to correctly display the proper information back to the end-user. Both platforms handle each event in a similar manner internally but may require different approaches.
For Android, we allow for EventCallback
and Event
objects to be registered with the appropriate manager. Some method calls also allow for specific EventCallback
and Callback
objects to be passed in as an argument callback. Be careful when using both the event system through the SDK’s managers and the callback approach as this may lead to multiple calls to the same event.
For iOS, we allow for Completion
blocks to be included in many of our function calls. Observers can also be registered through the NSNotificationCenter
.
These events are triggered through calls involving the AuthenticatorManager
.
Each EventCallback
has an onSuccess()
and onFailure()
method. They may also be registered as events by the manager.
EventCallback | Description | onSuccess() | onFailure() |
---|---|---|---|
DeviceLinkedEventCallback | Notified after the current device gets linked | Device (The current device) | Exception |
DeviceUnlinkedEventCallback | Notified after the current device gets unlinked | Device (The current device) | Exception |
EndAllSessionsEventCallback | Notified after endAllSessions() finishes | Void | Exception |
EndSessionEventCallback | Notified after endSession() finishes | Session | Exception |
GetDevicesEventCallback | Notified after getDevices() finishes | List<Device> | Exception |
GetSessionsEventCallback | Notified after getSessions() finishes | List<Session> | Exception |
UnlinkDeviceEventCallback (Any Device was unlinked) | Notified when any device for this user is unlinked and push is turned on | Device (The unlinked device) | Exception |
Each completion block will return information relating to the method being called.
Completion Block | Description | Parameters |
---|---|---|
completion | Returned after linkDevice call, unlinkDevice call | NSError |
endLKCSessionCompletion | Returned after endSession call | NSError |
getLKCSessionsCompletion | Returned after getSessions call | NSArray of LKCSession objects, NSError |
getDevicesCompletionLKC | Returned after getDevices call | NSArray of LKCDevice objects, NSError |
DeviceLinkedEventCallback deviceLinkedEventCallback = new DeviceLinkedEventCallback() {
@Override public void onSuccess(Device device) {
showDeviceLinked(device);
}
@Override public void onFailure(@NonNull Exception e) {
showFailure(e);
}
};
UnlinkDeviceEventCallback unlinkDeviceEventCallback = new UnlinkDeviceEventCallback() {
@Override public void onSuccess(Device device) {
showDeviceUnlinked(device);
}
@Override public void onFailure(@NonNull Exception e) {
showFailure(e);
}
};
@Override
public void onResume() {
super.onResume();
authenticatorManager.registerForEvents(deviceLinkedEventCallback, unlinkDeviceEventCallback);
refreshLinkStatus();
}
@Override
public void onPause() {
authenticatorManager.unregisterForEvents(deviceLinkedEventCallback, unlinkDeviceEventCallback);
super.onPause();
}
-(void)linkDevice
{
[[LKCAuthenticatorManager sharedClient] linkDevice:@"ABC1234" withSDKKey:@"sdkKey" withDeviceName:@"iPhone" deviceNameOverride:YES withCompletion:^(NSError *error)
{
if(error == nil)
{
// Link was successful
}
}];
}
-(void)unlinkDevice
{
[[LKCAuthenticatorManager sharedClient] unlinkDevice:deviceToUnlink withCompletion:^(NSError *error){
if(error == nil)
{
// Unlink was successful
}
}];
}
func linkDevice()
{
LKCAuthenticatorManager.sharedClient().linkDevice("ABC1234", withSDKKey:"sdkKey", withDeviceName: "iPhone", deviceNameOverride:true, withCompletion: { (error) in
if((error) == nil)
{
// Link was successful
}
})
}
func unlinkDevice()
{
LKCAuthenticatorManager.sharedClient().unlinkDevice(deviceToUnlink, withCompletion: { (error) in
if((error) == nil)
{
// Unlink was successful
}
})
}
These events are triggered through calls involving the AuthRequestManager
.
Each have an onSuccess()
and onFailure()
method. They may also be registered as events by the manager.
Event / EventCallback | Description | onSuccess() | onFailure() |
---|---|---|---|
AuthRequestPushReceivedEvent | Notified when a push notification is received for an auth request | Void | Exception |
AuthRequestResponseEvent | Notified after the End User has attempted to respond to a pending Auth Request | AuthRequestResponse | Exception |
GetAuthRequestEventCallback | Notified after a check is made to obtain a pending Auth Request | AuthRequest | Exception |
Each completion block will return information relating to the method being called.
Completion Block | Description | Parameters |
---|---|---|
checkForPendingAuthRequestCompletion | Returned after checkAuthRequestWithCompletion | LKCAuthRequestDetails, NSError |
denyAuthCompletion | Returned after denyAndSendWithReasonID call, sendWithCompletion call | NSError |
AuthRequestResponseEventCallback authRequestResponseEventCallback = new AuthRequestResponseEventCallback() {
@Override public void onSuccess(@NonNull AuthRequestResponse authRequestResponse) {
displayAuthRequestResponse(authRequestResponse);
}
@Override public void onFailure(@NonNull Exception e) {
handleFailure(e);
}
};
GetAuthRequestEventCallback getAuthRequestEventCallback = new GetAuthRequestEventCallback() {
@Override public void onSuccess(@Nullable AuthRequest authRequest) {
if (authRequest != null) {
displayAuthRequest(authRequest);
}
}
@Override public void onFailure(@NonNull Exception e) {
handleFailure(e);
}
};
@Override
public void onResume() {
...
authRequestManager.registerForEvents(authRequestResponseEventCallback, getAuthRequestEventCallback);
}
@Override
public void onPause() {
authRequestManager.unregisterForEvents(authRequestResponseEventCallback, getAuthRequestEventCallback);
...
}
// check and get a pending auth request
[[LKCAuthRequestManager sharedManager] checkAuthRequestWithCompletion:^(LKCAuthRequestDetails *requestDetails, NSError *error) {
..
}];
// get the auth methods required for verification
NSArray *methods = [[LKCAuthRequestManager sharedManager] getMethodsToVerify];
// accept an auth request
BOOL acceptAuthRequest = [[LKCAuthRequestManager sharedManager] acceptAndSendIfFailed];
// send a response for an auth request
[[LKCAuthRequestManager sharedManager] sendWithCompletion:^(NSError *error) {
..
}];
// check and get a pending auth request
LKCAuthRequestManager.shared()?.checkAuthRequest(completion: { (authRequestObject, error) in
..
})
// get the auth methods required for verification
var methods = LKCAuthRequestManager.shared()?.getMethodsToVerify() as! NSArray
// accept an auth request
LKCAuthRequestManager.shared()?.acceptAndSendIfFailed()
// send a response for an auth request
LKCAuthRequestManager.shared()?.send(completion: { (error) in
..
})
These events are triggered through callbacks/completions with certain Auth Method Managers.
PINCodeManager & CircleCodeManager both use the same callbacks. Each callback has a onVerificationSuccess()
and onVerificationFailure()
.
Callback | Description | onVerificationSuccess() | onVerificationFailure() |
---|---|---|---|
AuthMethodVerificationCallback | Used whenever a user’s auth method must be verified. Called after changeVerificationFlag(), removePINCode(), removeCircleCode() finishes. | null |
|
AuthMethodAuthRequestVerificationCallback | Used whenever a user’s auth method must be verified specifically for an auth request. | boolean if an auth request was sent as a result of failing verification of this Auth Method. |
|
Some callback calls may have different onSuccess()
and onFailure
method signatures (i.e. onAddSuccess()
vs onRemoveSuccess()
).
Callback | Description | onSuccess() | onFailure() |
---|---|---|---|
AddWearableCallback | Used when adding a Wearable via addWearable() |
null | Exception |
RemoveWearableCallback | Used when removing a Wearable via removeWearable() |
null | Exception |
CancelRemoveWearableCallback | Used when cancelling the removal of a Wearable via cancelRemoveWearable() |
null | Exception |
GetAvailableWearablesCallback | Used when getting the available list of Wearable objects via getAvailableWearables() |
List<Wearable> |
Exception |
GetStoredWearablesCallback | Used when getting the set list of Wearable objects via getStoredWearables() |
List<Wearable> |
Exception |
GetWearablesVerificationFlagCallback | Used when getting the VerificationFlag via getVerificationFlag() |
VerificationFlag |
Exception |
ChangeWearablesVerificationFlagCallback | Used when changing the VerificationFlag via changeVerificationFlag() |
VerificationFlag (new) |
Exception |
Callback | Description | onSuccess() | onFailure() |
---|---|---|---|
SetBiometricCallback | Used when setting a Biometric via setBiometric() |
null | Failure |
AuthMethodVerificationCallback | Used whenever a user’s auth method must be verified. Called after changeVerificationFlag(), removePINCode(), removeCircleCode() finishes. | null |
|
AuthMethodAuthRequestVerificationCallback | Used whenever a user’s auth method must be verified specifically for an auth request. | boolean if an auth request was sent as a result of failing verification of this Auth Method. |
|
Callback | Description | onSuccess() | onFailure() |
---|---|---|---|
AddLocationCallback | Used when adding a Location via addLocation() |
null | Exception |
RemoveLocationCallback | Used when removing a Location via removeLocation() |
null | Exception |
CancelRemoveLocationCallback | Used when cancelling the removal of a Location via cancelRemoveLocation() |
null | Exception |
GetStoredLocationsCallback | Used when getting the set list of Location objects via getStoredLocations() |
List<StoredLocation> |
Exception |
GetLocationsVerificationFlagCallback | Used when getting the VerificationFlag via getVerificationFlag() |
VerificationFlag |
Exception |
ChangeLocationsVerificationFlagCallback | Used when changing the VerificationFlag via changeVerificationFlag() |
VerificationFlag (new) |
Exception |
Callback | Description | onVerificationSuccess() | onVerificationFailure() |
---|---|---|---|
AuthMethodAuthRequestVerificationCallback | Used whenever a user’s auth method must be verified specifically for an auth request. | boolean if an auth request was sent as a result of failing verification of this Auth Method. |
|
Completion Block | Description | Parameters |
---|---|---|
pinCodeCheckCompletion | Returned after removePINCode, verifyPINCode, and changeVerificationFlag |
|
Completion Block | Description | Parameters |
---|---|---|
circleCodeCheckCompletion | Returned after removeCircleCode, verifyCircleCode, and changeVerificationFlag |
|
Completion Block | Description | Parameters |
---|---|---|
removeLocationCompletion | Returned after removeLocation |
|
cancelRemoveLocationCompletion | Returned after cancelRemove |
|
locationsCheckCompletion | Returned after verifyLocationsForAuthRequest |
|
getLocationsCompletion | Returned after getLocationsWithCompletion |
|
verificationFlagCompletion | Returned after changeVerificationFlagWithCompletion |
|
Completion Block | Description | Parameters |
---|---|---|
wearablesCompletion | Returned after getAvailableWearablesWithCompletion |
|
addWearableCompletion | Returned after addWearable |
|
removeWearableCompletion | Returned after removeWearable |
|
cancelRemoveWearableCompletion | Returned after cancelRemove |
|
wearablesCheckCompletion | Returned after verifyWearablesForAuthRequest |
|
getWearablesCompletion | Returned after getStoredWearablesWithCompletion |
|
verificationFlagCompletion | Returned after changeVerificationFlagWithCompletion |
|
Completion Block | Description | Parameters |
---|---|---|
fingerprintScanCompletion | Returned after setFingerprintScanWithVerificationFlag |
|
fingerprintScanCheckCompletion | Returned after removeFingerprintScanWithCompletion, verifyFingerprintScanForAuthRequest, and changeVerificationFlagWithCompletion |
|
Completion Block | Description | Parameters |
---|---|---|
faceScanCompletion | Returned after setFaceScanWithVerificationFlag |
|
faceScanCheckCompletion | Returned after removeFaceScanWithCompletion, verifyFaceScanForAuthRequest, and changeVerificationFlagWithCompletion |
|
TransUnion links to user contributed code as a resource to its community. TransUnion does not in any way guarantee or warrant the quality and security of these code bases. User contributed code is supported by the creators. If you do find a link from the site to user contributed code that is malicious or inappropriate in any way, please report that link to TransUnion immediately and we will investigate the claim. Submit any issue to TransUnion support at https://transunion.com/support. ×