DiscoverySessionCallback.OnServiceDiscoveredWithinRange Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
OnServiceDiscoveredWithinRange(ServiceDiscoveryInfo, Int32) |
Called when a subscribe operation results in a service discovery. |
OnServiceDiscoveredWithinRange(PeerHandle, Byte[], IList<Byte[]>, Int32) |
Called when a subscribe operation results in a service discovery. |
OnServiceDiscoveredWithinRange(ServiceDiscoveryInfo, Int32)
Called when a subscribe operation results in a service discovery.
[Android.Runtime.Register("onServiceDiscoveredWithinRange", "(Landroid/net/wifi/aware/ServiceDiscoveryInfo;I)V", "GetOnServiceDiscoveredWithinRange_Landroid_net_wifi_aware_ServiceDiscoveryInfo_IHandler", ApiSince=33)]
public virtual void OnServiceDiscoveredWithinRange (Android.Net.Wifi.Aware.ServiceDiscoveryInfo info, int distanceMm);
[<Android.Runtime.Register("onServiceDiscoveredWithinRange", "(Landroid/net/wifi/aware/ServiceDiscoveryInfo;I)V", "GetOnServiceDiscoveredWithinRange_Landroid_net_wifi_aware_ServiceDiscoveryInfo_IHandler", ApiSince=33)>]
abstract member OnServiceDiscoveredWithinRange : Android.Net.Wifi.Aware.ServiceDiscoveryInfo * int -> unit
override this.OnServiceDiscoveredWithinRange : Android.Net.Wifi.Aware.ServiceDiscoveryInfo * int -> unit
Parameters
- info
- ServiceDiscoveryInfo
A ServiceDiscoveryInfo
which indicate service config of the descovery
sessions.
- distanceMm
- Int32
The measured distance to the Publisher in mm. Note: the measured distance may be negative for very close devices.
- Attributes
Remarks
Called when a subscribe operation results in a service discovery. Called when a Subscribe service was configured with a range requirement SubscribeConfig.Builder#setMinDistanceMm(int)
and/or SubscribeConfig.Builder#setMaxDistanceMm(int)
and the Publish service was configured with PublishConfig.Builder#setRangingEnabled(boolean)
.
If either Publisher or Subscriber does not enable Ranging, or if Ranging is temporarily disabled by the underlying device, service discovery proceeds without ranging and the #onServiceDiscovered(PeerHandle, byte[], List)
is called.
Note: This method supersedes #onServiceDiscoveredWithinRange(PeerHandle, byte[], List, int)
and provides additional information - including cipher suite type and security context of the peer. Both the legacy and the new callback will be triggered on discovery.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
OnServiceDiscoveredWithinRange(PeerHandle, Byte[], IList<Byte[]>, Int32)
Called when a subscribe operation results in a service discovery.
[Android.Runtime.Register("onServiceDiscoveredWithinRange", "(Landroid/net/wifi/aware/PeerHandle;[BLjava/util/List;I)V", "GetOnServiceDiscoveredWithinRange_Landroid_net_wifi_aware_PeerHandle_arrayBLjava_util_List_IHandler", ApiSince=28)]
public virtual void OnServiceDiscoveredWithinRange (Android.Net.Wifi.Aware.PeerHandle? peerHandle, byte[]? serviceSpecificInfo, System.Collections.Generic.IList<byte[]>? matchFilter, int distanceMm);
[<Android.Runtime.Register("onServiceDiscoveredWithinRange", "(Landroid/net/wifi/aware/PeerHandle;[BLjava/util/List;I)V", "GetOnServiceDiscoveredWithinRange_Landroid_net_wifi_aware_PeerHandle_arrayBLjava_util_List_IHandler", ApiSince=28)>]
abstract member OnServiceDiscoveredWithinRange : Android.Net.Wifi.Aware.PeerHandle * byte[] * System.Collections.Generic.IList<byte[]> * int -> unit
override this.OnServiceDiscoveredWithinRange : Android.Net.Wifi.Aware.PeerHandle * byte[] * System.Collections.Generic.IList<byte[]> * int -> unit
Parameters
- peerHandle
- PeerHandle
An opaque handle to the peer matching our discovery operation.
- serviceSpecificInfo
- Byte[]
The service specific information (arbitrary byte array) provided by the peer as part of its discovery configuration.
The filter which resulted in this service discovery. For
PublishConfig#PUBLISH_TYPE_UNSOLICITED
,
SubscribeConfig#SUBSCRIBE_TYPE_PASSIVE
discovery sessions this is the publisher's
match filter. For PublishConfig#PUBLISH_TYPE_SOLICITED
,
SubscribeConfig#SUBSCRIBE_TYPE_ACTIVE
discovery sessions this
is the subscriber's match filter.
- distanceMm
- Int32
The measured distance to the Publisher in mm. Note: the measured distance may be negative for very close devices.
- Attributes
Remarks
Called when a subscribe operation results in a service discovery. Called when a Subscribe service was configured with a range requirement SubscribeConfig.Builder#setMinDistanceMm(int)
and/or SubscribeConfig.Builder#setMaxDistanceMm(int)
and the Publish service was configured with PublishConfig.Builder#setRangingEnabled(boolean)
.
If either Publisher or Subscriber does not enable Ranging, or if Ranging is temporarily disabled by the underlying device, service discovery proceeds without ranging and the #onServiceDiscovered(PeerHandle, byte[], List)
is called.
Note that this method and #onServiceDiscovered(PeerHandle, byte[], List)
may be called multiple times per service discovery.
Note: This method is superseded by #onServiceDiscoveredWithinRange(ServiceDiscoveryInfo, int)
which returns more information. Note that both legacy and new callback will be triggered on discovery.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.