Stay organized with collections
Save and categorize content based on your preferences.
ServiceResponseListener
interface ServiceResponseListener
Interface for callback invocation when service discovery response other than Upnp or Bonjour is received
Summary
Public methods |
abstract Unit |
The requested service response is available.
|
open Unit |
The requested USD based service response is available.
|
Public methods
onServiceAvailable
abstract fun onServiceAvailable(
protocolType: Int,
responseData: ByteArray!,
srcDevice: WifiP2pDevice!
): Unit
The requested service response is available.
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-03-13 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-13 UTC."],[],[],null,["# WifiP2pManager.ServiceResponseListener\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nServiceResponseListener\n=======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/wifi/p2p/WifiP2pManager.ServiceResponseListener \"View this page in Java\") \n\n```\ninterface ServiceResponseListener\n```\n\n|------------------------------------------------------------------|\n| [android.net.wifi.p2p.WifiP2pManager.ServiceResponseListener](#) |\n\nInterface for callback invocation when service discovery response other than Upnp or Bonjour is received\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onServiceAvailable](#onServiceAvailable(kotlin.Int,%20kotlin.ByteArray,%20android.net.wifi.p2p.WifiP2pDevice))`(`protocolType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `responseData:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`, `srcDevice:` `[WifiP2pDevice](/reference/kotlin/android/net/wifi/p2p/WifiP2pDevice)!`)` The requested service response is available. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onUsdBasedServiceAvailable](#onUsdBasedServiceAvailable(android.net.wifi.p2p.WifiP2pDevice,%20android.net.wifi.p2p.nsd.WifiP2pUsdBasedServiceResponse))`(`srcDevice:` `[WifiP2pDevice](/reference/kotlin/android/net/wifi/p2p/WifiP2pDevice)`, `usdResponseData:` `[WifiP2pUsdBasedServiceResponse](/reference/kotlin/android/net/wifi/p2p/nsd/WifiP2pUsdBasedServiceResponse)`)` The requested USD based service response is available. |\n\nPublic methods\n--------------\n\n### onServiceAvailable\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onServiceAvailable(\n protocolType: Int, \n responseData: ByteArray!, \n srcDevice: WifiP2pDevice!\n): Unit\n```\n\nThe requested service response is available.\n\n| Parameters ||\n|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `protocolType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): protocol type. currently only [WifiP2pServiceInfo.SERVICE_TYPE_VENDOR_SPECIFIC](/reference/kotlin/android/net/wifi/p2p/nsd/WifiP2pServiceInfo#SERVICE_TYPE_VENDOR_SPECIFIC:kotlin.Int). |\n| `responseData` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!: service discovery response data based on the requested service protocol type. The format depends on the service type. |\n| `srcDevice` | [WifiP2pDevice](/reference/kotlin/android/net/wifi/p2p/WifiP2pDevice)!: source device. |\n\n### onUsdBasedServiceAvailable\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onUsdBasedServiceAvailable(\n srcDevice: WifiP2pDevice, \n usdResponseData: WifiP2pUsdBasedServiceResponse\n): Unit\n```\n\nThe requested USD based service response is available.\n\n| Parameters ||\n|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `srcDevice` | [WifiP2pDevice](/reference/kotlin/android/net/wifi/p2p/WifiP2pDevice): source device. This value cannot be `null`. |\n| `usdResponseData` | [WifiP2pUsdBasedServiceResponse](/reference/kotlin/android/net/wifi/p2p/nsd/WifiP2pUsdBasedServiceResponse): [WifiP2pUsdBasedServiceResponse](/reference/kotlin/android/net/wifi/p2p/nsd/WifiP2pUsdBasedServiceResponse). This value cannot be `null`. |"]]