SubscribeDiscoverySession
open class SubscribeDiscoverySession : DiscoverySession
| kotlin.Any | ||
| ↳ | android.net.wifi.aware.DiscoverySession | |
| ↳ | android.net.wifi.aware.SubscribeDiscoverySession | |
A class representing a Aware subscribe session. Created when WifiAwareSession.subscribe(SubscribeConfig,DiscoverySessionCallback,android.os.Handler) is called and a discovery session is created and returned in DiscoverySessionCallback.onSubscribeStarted(SubscribeDiscoverySession). See baseline functionality of all discovery sessions in DiscoverySession. This object allows updating an existing/running subscribe discovery session using updateSubscribe(SubscribeConfig).
Summary
| Public methods | |
|---|---|
| open Boolean |
initiateDataPathRequest(peerHandle: PeerHandle, request: AwareDataPathRequest)Initiate a Wi-Fi Aware data path request to create a connection with the target peer. |
| open Unit |
updateSubscribe(subscribeConfig: SubscribeConfig)Re-configure the currently active subscribe session. |
| Inherited functions | |
|---|---|
Public methods
initiateDataPathRequest
open fun initiateDataPathRequest(
peerHandle: PeerHandle,
request: AwareDataPathRequest
): Boolean
Initiate a Wi-Fi Aware data path request to create a connection with the target peer. The Aware data path request should be done in the context of a discovery session - after a DiscoverySessionCallback.onServiceDiscovered(ServiceDiscoveryInfo) event is received. When the Aware data path setup succeeds, both side will receive DiscoverySessionCallback.onDataPathConnected(PeerHandle,WifiAwareNetworkInfo). Otherwise DiscoverySessionCallback.onDataPathRequestFailed(PeerHandle,int) will be called.
| Parameters | |
|---|---|
peerHandle |
PeerHandle: The peer's handle for the data path request. This value cannot be null. |
request |
AwareDataPathRequest: The data path request. This value cannot be null. |
| Return | |
|---|---|
Boolean |
true if framework starts the data path setup successfully, false otherwise. |
updateSubscribe
open fun updateSubscribe(subscribeConfig: SubscribeConfig): Unit
Re-configure the currently active subscribe session. The DiscoverySessionCallback is not replaced - the same listener used at creation is still used. The results of the configuration are returned using DiscoverySessionCallback:
DiscoverySessionCallback.onSessionConfigUpdated(): configuration update succeeded.DiscoverySessionCallback.onSessionConfigFailed(): configuration update failed. The subscribe discovery session is still running using its previous configuration (i.e. update failure does not terminate the session).
| Parameters | |
|---|---|
subscribeConfig |
SubscribeConfig: The new discovery subscribe session configuration (SubscribeConfig). This value cannot be null. |