BluetoothAdapter.CancelDiscovery 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.
Cancel the current device discovery process.
[Android.Runtime.Register("cancelDiscovery", "()Z", "")]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_SCAN")]
public bool CancelDiscovery ();
[<Android.Runtime.Register("cancelDiscovery", "()Z", "")>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_SCAN")>]
member this.CancelDiscovery : unit -> bool
Returns
true on success, false on error
- Attributes
Remarks
Cancel the current device discovery process.
Because discovery is a heavyweight procedure for the Bluetooth adapter, this method should always be called before attempting to connect to a remote device with android.bluetooth.BluetoothSocket#connect()
. Discovery is not managed by the Activity, but is run as a system service, so an application should always call cancel discovery even if it did not directly request a discovery, just to be sure.
If Bluetooth state is not #STATE_ON
, this API will return false. After turning on Bluetooth, wait for #ACTION_STATE_CHANGED
with #STATE_ON
to get the updated value.
Java documentation for android.bluetooth.BluetoothAdapter.cancelDiscovery()
.
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.