Comment on page

Driving Alert

Handles DrivingAlert related requests with IMS web services.
Notifies the server that the currently-logged-in user wishes to receive alerts.
Alerts will be sent when the driver with the specified driverId encounters an event specified by the DrivingAlertType.
The specified driver can be either the primary or any secondary driver in the user's account.

Required information

*Identity: In order to receive driving alerts, the application must have a valid user (represented by the Identity). That user must be active.
  • alertType: The type of alert to register.
The alertType can be acceleration, braking, lateNight, and speeding.

Concrete example

To register for receiving driving alerts, one can use following snippet
let service = DrivingAlertService(identity: identity)
service.registerAlertSetting(alertType, then: { result in
switch result {
case .success(_):
// successful
case .failure(_):
// error
val service = AlertService(identity)
service.registerAlert(alert) { result: Result<Content?>? ->
if (result?.value == null || result.throwable != null) {
// failure
} else {
// Success
val content = result.value