Comment on page
Device
Handles Device related requests with IMS web services. Unless otherwise specified, requests performed by this service are on the current Device.
*Identity: In order to activate device, the application must have a valid user (represented by the Identity). That user must be active.
To activate the current device for data collection, one can use following snippet.
Swift
Kotlin
let service = DeviceService(identity: identity)
service.activate(then: { result in
switch result {
case: .success(_)
// activation successful
case: .failure(_)
// failure error
}
})
val service = DeviceService(identity)
service.activate(activationMode) { result: Result<Content?>? ->
if (result?.value == null || result.throwable != null) {
// failure
} else {
// Success
val content = result.value
completionHandler(content)
}
})
Deactivate the current device for data collection. It may be desirable to deactivate a device if the host application's user logs out, or if the user becomes inactive.
*Identity: In order to deactivate device, the application must have a valid user (represented by the Identity). That user must be active.
To deactivate the current device for data collection, one can use following snippet.
Swift
Kotlin
let service = DeviceService(identity: identity)
service.deactivate(then: { result in
switch result {
case: .success(_)
// deactivation successful
case: .failure(_)
// failure error
}
})
val service = DeviceService(identity)
service.deactivate() { result: Result<Content?>? ->
if (result?.value == null || result.throwable != null) {
// failure
} else {
// Success
val content = result.value
completionHandler(content)
}
})
*Identity: In order to fetch device, the application must have a valid user (represented by the Identity). That user must be active.
To fetch the current
Device
's model., one can use following snippet.Swift
let service = DeviceService(identity: identity)
service.fetch(then: { result in
guard !result.value.isEmpty else {
// error
return
}
completionHandler(.success(result.value))
})
Last modified 2mo ago