# onAppStatusChanged

Notification (Navigation and application).

Notification when the application starts, is foregrounded, backgrounded or stopped (enabled by default)

Reports BeNav's own lifecycle: finished starting up, came to the foreground, went to the background,
and shut down. It answers a question a client application otherwise has no way to ask: is BeNav
running, and is the driver actually looking at it?

The startup event matters most in practice: it marks the moment BeNav is ready to accept commands,
so a client application can wait for it rather than sending into a void and handling the refusal.

**Worth knowing**

- Unlike the guidance notifications, this one is **enabled by default**. Turn it off
  with [`setupNotifications`](https://docs.benomad.com/benav-rnc/commands/setup-notifications.md) if it is not wanted.
- The shutdown event is sent as BeNav exits, so a client application can tell a deliberate stop
  from a crash or a device going flat.

## Configuration

```json
{
  "name":"onAppStatusChanged",
  "params": {
    "enabled": true
  }
}
```

## Notification Data

```json
{
  "jsonrpc": "2.0",
  "method": "onAppStatusChanged",
  "params": {
    "event": "appInForeground"
  }
}
```

- `event` one of `startupComplete`, `appInForeground`, `appInBackground`, `appStopped`. `appStopped` is emitted once as the application terminates - on a swipe-away, the quit dialog, or the [`stopApp`](https://docs.benomad.com/benav-rnc/commands/stop-app.md) command.
