# SdkDiagnostics

Container for SDK diagnostics observers.

Use this class to register callbacks for internal SDK diagnostic events and pass them to `SentianceOptions.Builder.diagnostics(...)` during SDK initialization.

## SdkDiagnostics API

### `getGooglePlayServicesObserver`

> ```java
> @Nullable GooglePlayServicesObserver getGooglePlayServicesObserver()
> ```
>
> Returns the [observer](/important-topics/sdk/api-reference/android/sdkdiagnostics/googleplayservicesobserver.md) for Google Play Services related diagnostic events.\
> Returns `null` if no Google Play Services observer is configured.

### `getServiceLifecycleObserver`

> ```java
> @Nullable ServiceLifecycleObserver getServiceLifecycleObserver()
> ```
>
> Returns the [observer](/important-topics/sdk/api-reference/android/sdkdiagnostics/servicelifecycleobserver.md) for SDK service lifecycle diagnostic events.\
> Returns `null` if no service lifecycle observer is configured.

## SdkDiagnostics.Builder API

Builder class for `SdkDiagnostics`.

### `Builder`

> ```java
> Builder()
> ```
>
> Creates a builder used to configure diagnostics observers.

### `googlePlayServicesObserver`

> ```java
> Builder googlePlayServicesObserver(GooglePlayServicesObserver observer)
> ```
>
> Registers an [observer](/important-topics/sdk/api-reference/android/sdkdiagnostics/googleplayservicesobserver.md) for Google Play Services related diagnostic events.\
> Returns the same builder instance for chaining.

### `serviceLifecycleObserver`

> ```java
> Builder serviceLifecycleObserver(ServiceLifecycleObserver observer)
> ```
>
> Registers an [observer](/important-topics/sdk/api-reference/android/sdkdiagnostics/servicelifecycleobserver.md) for SDK service lifecycle diagnostic events.\
> Returns the same builder instance for chaining.

### `build`

> ```java
> SdkDiagnostics build()
> ```
>
> Builds and returns a `SdkDiagnostics` instance containing the configured observers.

## Example

```java
SdkDiagnostics diagnostics =
        new SdkDiagnostics.Builder()
                .googlePlayServicesObserver(myGooglePlayServicesObserver)
                .serviceLifecycleObserver(myServiceLifecycleObserver)
                .build();

SentianceOptions options =
        new SentianceOptions.Builder(context)
                .diagnostics(diagnostics)
                .build();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sentiance.com/important-topics/sdk/api-reference/android/sdkdiagnostics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
