Stay organized with collections
Save and categorize content based on your preferences.
Discovery
@RequiresApi(value = 26) interface Discovery
Entry point for discovering devices.
Summary
Public methods
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# Discovery\n=========\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/com/google/ambient/crossdevice/discovery/Discovery \"View this page in Kotlin\") \\|Java\n\n\n```\n@RequiresApi(value = 26) interface Discovery\n```\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nEntry point for discovering devices.\n\nSummary\n-------\n\n| ### Nested types ||\n|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Discovery.Companion](/reference/com/google/ambient/crossdevice/discovery/Discovery.Companion) | |\n| [Discovery.OnDevicePickerResultListener](/reference/com/google/ambient/crossdevice/discovery/Discovery.OnDevicePickerResultListener) | Interface to receive the result from the device picker, for use with [registerForResult](/reference/com/google/ambient/crossdevice/discovery/Discovery#registerForResult(androidx.activity.result.ActivityResultCaller,com.google.ambient.crossdevice.discovery.Discovery.OnDevicePickerResultListener)). |\n\n| ### Public methods ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `abstract `[Participant](/reference/com/google/ambient/crossdevice/Participant) | [getParticipantFromIntent](/reference/com/google/ambient/crossdevice/discovery/Discovery#getParticipantFromIntent(android.content.Intent))`(@`[NonNull](/reference/androidx/annotation/NonNull)` `[Intent](/reference/android/content/Intent)` intent)` Gets the participant from an incoming [Intent](/reference/android/content/Intent). |\n| `abstract @`[NonNull](/reference/androidx/annotation/NonNull)` `[DevicePickerLauncher](/reference/com/google/ambient/crossdevice/discovery/DevicePickerLauncher) | [registerForResult](/reference/com/google/ambient/crossdevice/discovery/Discovery#registerForResult(androidx.activity.result.ActivityResultCaller,com.google.ambient.crossdevice.discovery.Discovery.OnDevicePickerResultListener))`(` ` @`[NonNull](/reference/androidx/annotation/NonNull)` `[ActivityResultCaller](/reference/androidx/activity/result/ActivityResultCaller)` caller,` ` @`[NonNull](/reference/androidx/annotation/NonNull)` `[Discovery.OnDevicePickerResultListener](/reference/com/google/ambient/crossdevice/discovery/Discovery.OnDevicePickerResultListener)` callback` `)` Registers a callback for discovery. |\n\nPublic methods\n--------------\n\n### getParticipantFromIntent\n\n```\nabstract Participant getParticipantFromIntent(@NonNull Intent intent)\n```\n\nGets the participant from an incoming [Intent](/reference/android/content/Intent). Used to begin the process of accepting a remote connection with a [Participant](/reference/com/google/ambient/crossdevice/Participant). Returns null if the [Intent](/reference/android/content/Intent) is not valid for getting a [Participant](/reference/com/google/ambient/crossdevice/Participant). \n\n### registerForResult\n\n```\nabstract @NonNull DevicePickerLauncher registerForResult(\n @NonNull ActivityResultCaller caller,\n @NonNull Discovery.OnDevicePickerResultListener callback\n)\n```\n\nRegisters a callback for discovery. \n\n| Parameters ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|\n| `@`[NonNull](/reference/androidx/annotation/NonNull)` `[ActivityResultCaller](/reference/androidx/activity/result/ActivityResultCaller)` caller` | The calling activity or fragment. |\n| `@`[NonNull](/reference/androidx/annotation/NonNull)` `[Discovery.OnDevicePickerResultListener](/reference/com/google/ambient/crossdevice/discovery/Discovery.OnDevicePickerResultListener)` callback` | The callback to be called when devices are selected by a user. |\n\n| Returns ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|\n| `@`[NonNull](/reference/androidx/annotation/NonNull)` `[DevicePickerLauncher](/reference/com/google/ambient/crossdevice/discovery/DevicePickerLauncher) | The launcher to use to show a device picker UI to the user. |"]]