> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# addLynxViewClient

APISummary
Register lifecycle event observer for `LynxView`.

## Syntax

### Android

```java
public void addLynxViewClient(LynxViewClient client);
```

#### Parameters

- `client`: The structure implemented by the client and registered to the `LynxView` instance is used to obtain the callbacks of each process in the `LynxView` lifecycle

### iOS

```objc
- (void)addLifecycleClient:(nonnull id<LynxViewBaseLifecycle>)lifecycleClient;
```

#### Parameters

- `lifecycleClient`: The structure implemented by the client and registered to the `LynxView` instance is used to obtain the callbacks of each process in the `LynxView` lifecycle.

### Harmony

#### Field

LynxView has clients member:

- `clients: LynxViewClient[]`: The structure implemented by the client and registered to the `LynxView` instance is used to obtain the callbacks of each process in the `LynxView` lifecycle.

On the HarmonyOS platfrom, you need to pass your implemented LynxViewClient as a parameter during the initialization of LynxView:

```typescript
@Entry
@Component
struct Index {
  private clients: EntryLynxClient[] = [new EntryLynxClient()];

  build() {
    Column() {
      LynxView({
        clients: this.clients,
      }).width('100%').height('100%');
    }
    .size({ width: '100%', height: '100%' })
  }
}
```

### Desktop (C++)

```cpp
void AddClient(std::shared_ptr<lynx::pub::LynxViewClient> client);
```

#### Parameters

- `client`: The lifecycle observer registered to the `LynxView` instance. The same client instance is retained by `LynxView` until it is removed.

## Compatibility

**Compatibility Table**

**Query:** `lynx-native-api.lynx-view.add-lynx-view-client`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-native-api/lynx-view/add-lynx-view-client.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| add-lynx-view-client | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (3.7) | Yes (3.7) | No |

**`add-lynx-view-client`**

register lifecycle observer for lynxView

**Specifications:**

