Notifications
All NSNotification constants provided by the Aila SDK.
Overview
The SDK posts notifications to the default NSNotificationCenter for various events. Subscribe to these notifications to react to hardware changes, scan events, and other system events.
AilaMobileImagerStateChangedNotification
Posted when the scanning state is changed by depressing the dedicated scan buttons on Aila's Mobile Imager.
Aila_Start() and Aila_Stop() do not trigger this notification.
- Objective-C
- Swift
extern NSString *const AilaMobileImagerStateChangedNotification;
let AilaMobileImagerStateChangedNotification: String
userInfo Dictionary:
| Key | Value |
|---|---|
state | @YES if scanning started, @NO if stopped |
Usage:
- Objective-C
- Swift
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleImagerStateChanged:)
name:AilaMobileImagerStateChangedNotification
object:nil];
- (void)handleImagerStateChanged:(NSNotification *)notification {
BOOL isScanning = [notification.userInfo[@"state"] boolValue];
NSLog(@"Scanning state: %@", isScanning ? @"Started" : @"Stopped");
}
NotificationCenter.default.addObserver(
self,
selector: #selector(handleImagerStateChanged),
name: NSNotification.Name(AilaMobileImagerStateChangedNotification),
object: nil
)
@objc func handleImagerStateChanged(_ notification: Notification) {
if let isScanning = notification.userInfo?["state"] as? Bool {
print("Scanning state: \(isScanning ? "Started" : "Stopped")")
}
}
AilaHardwareChangedNotification
Posted when a change in system configuration is detected (e.g., hardware connected or disconnected).
- Objective-C
- Swift
extern NSString *const AilaHardwareChangedNotification;
let AilaHardwareChangedNotification: String
userInfo Dictionary:
| Key | Value |
|---|---|
hardwareClass | [NSNumber numberWithInt:Aila_GetHardwareClass()] |
Usage:
- Objective-C
- Swift
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleHardwareChanged:)
name:AilaHardwareChangedNotification
object:nil];
- (void)handleHardwareChanged:(NSNotification *)notification {
AilaHardwareClass hardwareClass = [notification.userInfo[@"hardwareClass"] intValue];
NSLog(@"Hardware changed: %d", hardwareClass);
}
NotificationCenter.default.addObserver(
self,
selector: #selector(handleHardwareChanged),
name: NSNotification.Name(AilaHardwareChangedNotification),
object: nil
)
@objc func handleHardwareChanged(_ notification: Notification) {
if let hardwareClassNum = notification.userInfo?["hardwareClass"] as? Int {
let hardwareClass = AilaHardwareClass(rawValue: hardwareClassNum)
print("Hardware changed: \(String(describing: hardwareClass))")
}
}
AilaID1CardDetectedNotification
Posted when a card is detected in the tray (when id1CardDetectionMode is enabled).
- Objective-C
- Swift
extern NSString *const AilaID1CardDetectedNotification;
let AilaID1CardDetectedNotification: String
userInfo Dictionary: nil
Usage:
- Objective-C
- Swift
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleCardDetected:)
name:AilaID1CardDetectedNotification
object:nil];
- (void)handleCardDetected:(NSNotification *)notification {
NSLog(@"Card detected in tray");
// Trigger image capture
Aila_ID1CaptureImage(^(UIImage *image, NSError *error) {
// Handle captured image
});
}
NotificationCenter.default.addObserver(
self,
selector: #selector(handleCardDetected),
name: NSNotification.Name(AilaID1CardDetectedNotification),
object: nil
)
@objc func handleCardDetected(_ notification: Notification) {
print("Card detected in tray")
// Trigger image capture
Aila_ID1CaptureImage { image, error in
// Handle captured image
}
}
AilaMRZDetectedNotification
Posted when MRZ components are detected in the camera feed (when mrzDetectionMode is enabled).
This provides early indication that an MRZ document is present, before complete scanning occurs. The notification fires when the SDK detects any MRZ components such as document numbers, birth dates, expiry dates, or personal identification numbers.
- Objective-C
- Swift
extern NSString *const AilaMRZDetectedNotification;
let AilaMRZDetectedNotification: String
userInfo Dictionary: nil
Usage:
- Objective-C
- Swift
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleMRZDetected:)
name:AilaMRZDetectedNotification
object:nil];
- (void)handleMRZDetected:(NSNotification *)notification {
NSLog(@"MRZ document detected");
// Update UI to guide user
}
NotificationCenter.default.addObserver(
self,
selector: #selector(handleMRZDetected),
name: NSNotification.Name(AilaMRZDetectedNotification),
object: nil
)
@objc func handleMRZDetected(_ notification: Notification) {
print("MRZ document detected")
// Update UI to guide user
}
AilaFirmwareNotification
Posted when an attempt at a firmware update is started or finished.
- Objective-C
- Swift
extern NSString *const AilaFirmwareNotification;
let AilaFirmwareNotification: String
userInfo Dictionary:
| Key | Value |
|---|---|
firmwareStatus | BOOL |
Usage:
- Objective-C
- Swift
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleFirmwareUpdate:)
name:AilaFirmwareNotification
object:nil];
- (void)handleFirmwareUpdate:(NSNotification *)notification {
BOOL status = [notification.userInfo[@"firmwareStatus"] boolValue];
NSLog(@"Firmware update status: %@", status ? @"Success" : @"Failed");
}
NotificationCenter.default.addObserver(
self,
selector: #selector(handleFirmwareUpdate),
name: NSNotification.Name(AilaFirmwareNotification),
object: nil
)
@objc func handleFirmwareUpdate(_ notification: Notification) {
if let status = notification.userInfo?["firmwareStatus"] as? Bool {
print("Firmware update status: \(status ? "Success" : "Failed")")
}
}
AilaSetCodesNotification
Posted when there is an internal setting or checking of enabled barcodes.
- Objective-C
- Swift
extern NSString *const AilaSetCodesNotification;
let AilaSetCodesNotification: String
userInfo Dictionary: nil
Usage:
- Objective-C
- Swift
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleSetCodes:)
name:AilaSetCodesNotification
object:nil];
- (void)handleSetCodes:(NSNotification *)notification {
NSLog(@"Barcode configuration changed");
}
NotificationCenter.default.addObserver(
self,
selector: #selector(handleSetCodes),
name: NSNotification.Name(AilaSetCodesNotification),
object: nil
)
@objc func handleSetCodes(_ notification: Notification) {
print("Barcode configuration changed")
}
AilaSetLicenseNotification
Posted when there are internal or cloud-based changes to the SDK licensing.
- Objective-C
- Swift
extern NSString *const AilaSetLicenseNotification;
let AilaSetLicenseNotification: String
userInfo Dictionary: nil
Usage:
- Objective-C
- Swift
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleLicenseChanged:)
name:AilaSetLicenseNotification
object:nil];
- (void)handleLicenseChanged:(NSNotification *)notification {
NSLog(@"License configuration changed");
// Optionally refresh license info
NSString *info = Aila_GetSDKLicensingInfo();
}
NotificationCenter.default.addObserver(
self,
selector: #selector(handleLicenseChanged),
name: NSNotification.Name(AilaSetLicenseNotification),
object: nil
)
@objc func handleLicenseChanged(_ notification: Notification) {
print("License configuration changed")
// Optionally refresh license info
let info = Aila_GetSDKLicensingInfo()
}
See Also
- AilaConfiguration - Configure notification triggers
- Aila_GetHardwareClass - Get current hardware class
- Aila_ID1CaptureImage - Capture card images