# Driving Alert

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.

**Parameters:**

* `alertType`: The type of alert to register.

The `alertType` can be `acceleration`, `braking`, `lateNight`, and `speeding.`

To register for receiving driving alerts, the following API can be used.

### Concrete example

{% tabs %}
{% tab title="Swift" %}

```swift
let service = DrivingAlertService()
service.registerAlertSetting(alertType, then: { result in
    switch result {
    case .success(_):
        // successful
    case .failure(_):
        // error
    }
})
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val service = AlertService()
service.registerAlert(alert) { result: Result<Content?>? ->
    if (result?.value == null || result.throwable != null) {
        // failure
    } else {
        // Success
        val content = result.value
    }
})
```

{% endtab %}
{% endtabs %}
