# Notifications, App Links & faults

Source: https://olef.dev/docs/guides/notifications-links-faults

**Outcome:** test the real-world edges where Android apps actually break—notifications, deep-link routing, split APKs, poor connectivity, process death, GPS changes, and folding screens.

## Ask your agent

```text
Trigger a chat notification, reply to it inline using Olef without echoing the
reply text in logs, open the resulting deep link, and verify the conversation
survives process death via `olef fault inject`.
```

## 1. Inspect and act on notifications

Notifications are often the entry point to a user flow. Listing and waiting run from the host scoped to `--app`:

```bash
olef device notifications list --app com.example.app
olef device notifications wait --app com.example.app --timeout-ms 10000
```

To dismiss a notification or tap one of its actions—including `RemoteInput` inline replies with secret-safe environment variable input—Olef lazily enables its `NotificationListenerService` and revokes it automatically on `olef disconnect`:

```bash
export REPLY_TEXT="On my way!"
olef device notifications action --app com.example.app \
  --key "<notification-key>" --action "Reply" --reply-env REPLY_TEXT
```

## 2. Inspect APKs, split installs, App Links & intents

Check the built artifact offline before installing it, stream split APKs, verify Android App Links domain state, and launch typed intents:

```bash
olef app inspect app/build/outputs/apk/debug/app-debug.apk
olef app install base.apk config.arm64_v8a.apk --inherit-unchanged
olef app applinks --app com.example.app
olef app resolve-intent --action android.intent.action.VIEW --data "https://example.com/item/42"
olef app open-intent --action android.intent.action.VIEW --data "https://example.com/item/42" --expect-front
```

Use `--extra-str-env` to pass sensitive string extras without writing them into command logs or JSON output.

## 3. Inject and clean up faults on purpose

List all supported fault kinds (one-off actions vs. stateful faults undone by `fault clear`):

```bash
olef fault kinds
```

Exercise process death, airplane mode, GPS location changes (emulator), or foldable device posture transitions:

```bash
olef fault inject process-death --app com.example.app
olef fault inject location --lat 37.7749 --lon -122.4194
olef fault inject posture --state half-opened
olef fault list
olef fault clear --all
```

For multi-step chaos checks, `olef fault run <scenario.json>` executes commands, faults, waits, and assertions—and guarantees every injected fault is cleared when the run exits, pass or fail.

## Limits

- `fault inject location` is emulator-only; `fault inject posture` requires a device or emulator advertising multiple hinge states.
- `app inspect` requires `aapt2` (part of Android SDK Build-Tools).

See [`olef device`](https://olef.dev/docs/reference/cli/device), [`olef app`](https://olef.dev/docs/reference/cli/app), and [`olef fault`](https://olef.dev/docs/reference/cli/fault).
