Get SDK Information
The GetInformation Event is used to obtain all the required information for the SDK which the client is using. You can find SDK Information related events here,
GetInformation event flow-diagram
Here is the event flow diagram to show the details of how this works:
iOS/Swift
For Swift, the following snippet can be sued to trigger the event, where the response can be processed in the completion handler:
Triggering GetInformation Event (Swift)
static func getDeviceInformation(request: DeviceInfoRequest, completion: @escaping (ActionResult, DeviceInfo?) -> Void) {
let userIdentifier = KsUserIdentifier(tenantId: request.tenant, userId: request.user)
let event = KSMGetDeviceInformationEvent(userIdentifier: userIdentifier)
let timer = CallTimer(event: event)
MasterControllerAdapter.sharedInstance.sendEvent2MasterController(event: event) { resultEvent in
let duration = timer.stop()
if let informationResult = resultEvent as? KSMGetDeviceInformationResultEvent {
let actionResult = ActionResult(title: "deviceInformationModel.title".localized(table: localizedTable),
success: true,
error: nil,
duration: duration,
event: resultEvent)
let info = DeviceInfo(id: informationResult.deviceId,
name: informationResult.deviceName)
EventLogObject(actionResult: actionResult,
component: localizedTable)
completion(actionResult, info)
} else {
let actionResult = ActionResult(title: "deviceInformationModel.title".localized(table: localizedTable),
success: false,
error: "deviceInformationModel.status.unexpectedEvent".localized(table: localizedTable),
duration: duration,
event: event)
EventLogObject(actionResult: actionResult,
component: localizedTable)
completion(actionResult, nil)
}
}
}
Android/Kotlin
Triggering GetInformation Event (Kotlin)
fun triggerGetInformationEvent() {
synchronousEventHandler.postEvent(GetInformationEvent())?.then {
// handle result
}
}