# Discovery

# Discovery

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/com/google/ambient/crossdevice/discovery/Discovery "View this page in Kotlin")\|Java

<br />

```
@RequiresApi(value = 26) interface Discovery
```

<br />

*** ** * ** ***

Entry point for discovering devices.

## Summary

|                                                                                                                                                                                                                                             ### Nested types                                                                                                                                                                                                                                             ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Discovery.Companion](https://developer.android.com/reference/com/google/ambient/crossdevice/discovery/Discovery.Companion)                                       |                                                                                                                                                                                                                                                                                                                                       |
| [Discovery.OnDevicePickerResultListener](https://developer.android.com/reference/com/google/ambient/crossdevice/discovery/Discovery.OnDevicePickerResultListener) | Interface to receive the result from the device picker, for use with[registerForResult](https://developer.android.com/reference/com/google/ambient/crossdevice/discovery/Discovery#registerForResult(androidx.activity.result.ActivityResultCaller,com.google.ambient.crossdevice.discovery.Discovery.OnDevicePickerResultListener)). |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `abstract `[Participant](https://developer.android.com/reference/com/google/ambient/crossdevice/Participant)                                                                                                               | [getParticipantFromIntent](https://developer.android.com/reference/com/google/ambient/crossdevice/discovery/Discovery#getParticipantFromIntent(android.content.Intent))`(@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[Intent](https://developer.android.com/reference/android/content/Intent)` intent)` Gets the participant from an incoming[Intent](https://developer.android.com/reference/android/content/Intent).                                                                                                                                                                                                                                                                                                                              |
| `abstract @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[DevicePickerLauncher](https://developer.android.com/reference/com/google/ambient/crossdevice/discovery/DevicePickerLauncher) | [registerForResult](https://developer.android.com/reference/com/google/ambient/crossdevice/discovery/Discovery#registerForResult(androidx.activity.result.ActivityResultCaller,com.google.ambient.crossdevice.discovery.Discovery.OnDevicePickerResultListener))`(` ` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[ActivityResultCaller](https://developer.android.com/reference/androidx/activity/result/ActivityResultCaller)` caller,` ` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[Discovery.OnDevicePickerResultListener](https://developer.android.com/reference/com/google/ambient/crossdevice/discovery/Discovery.OnDevicePickerResultListener)` callback` `)` Registers a callback for discovery. |

## Public methods

### getParticipantFromIntent

```
abstract Participant getParticipantFromIntent(@NonNull Intent intent)
```

Gets the participant from an incoming[Intent](https://developer.android.com/reference/android/content/Intent). Used to begin the process of accepting a remote connection with a[Participant](https://developer.android.com/reference/com/google/ambient/crossdevice/Participant). Returns null if the[Intent](https://developer.android.com/reference/android/content/Intent)is not valid for getting a[Participant](https://developer.android.com/reference/com/google/ambient/crossdevice/Participant).  

### registerForResult

```
abstract @NonNull DevicePickerLauncher registerForResult(
    @NonNull ActivityResultCaller caller,
    @NonNull Discovery.OnDevicePickerResultListener callback
)
```

Registers a callback for discovery.  

|                                                                                                                                                            Parameters                                                                                                                                                            ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|
| `@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[ActivityResultCaller](https://developer.android.com/reference/androidx/activity/result/ActivityResultCaller)` caller`                                                       | The calling activity or fragment.                              |
| `@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[Discovery.OnDevicePickerResultListener](https://developer.android.com/reference/com/google/ambient/crossdevice/discovery/Discovery.OnDevicePickerResultListener)` callback` | The callback to be called when devices are selected by a user. |

|                                                                                                                                    Returns                                                                                                                                     ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| `@`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[DevicePickerLauncher](https://developer.android.com/reference/com/google/ambient/crossdevice/discovery/DevicePickerLauncher) | The launcher to use to show a device picker UI to the user. |