BluetoothAdapter Class
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.
Represents the local device Bluetooth adapter.
[Android.Runtime.Register("android/bluetooth/BluetoothAdapter", DoNotGenerateAcw=true)]
public sealed class BluetoothAdapter : Java.Lang.Object
[<Android.Runtime.Register("android/bluetooth/BluetoothAdapter", DoNotGenerateAcw=true)>]
type BluetoothAdapter = class
inherit Object
- Inheritance
- Attributes
Remarks
Represents the local device Bluetooth adapter. The BluetoothAdapter
lets you perform fundamental Bluetooth tasks, such as initiate device discovery, query a list of bonded (paired) devices, instantiate a BluetoothDevice
using a known MAC address, and create a BluetoothServerSocket
to listen for connection requests from other devices, and start a scan for Bluetooth LE devices.
To get a BluetoothAdapter
representing the local Bluetooth adapter, call the BluetoothManager#getAdapter
function on BluetoothManager
. On JELLY_BEAN_MR1 and below you will need to use the static #getDefaultAdapter
method instead.
Fundamentally, this is your starting point for all Bluetooth actions. Once you have the local adapter, you can get a set of BluetoothDevice
objects representing all paired devices with #getBondedDevices()
; start device discovery with #startDiscovery()
; or create a BluetoothServerSocket
to listen for incoming RFComm connection requests with #listenUsingRfcommWithServiceRecord(String, UUID)
; listen for incoming L2CAP Connection-oriented Channels (CoC) connection requests with #listenUsingL2capChannel()
; or start a scan for Bluetooth LE devices with #startLeScan(LeScanCallback callback)
.
This class is thread safe. <div class="special reference">
<h3>Developer Guides</h3>
For more information about using Bluetooth, read the Bluetooth developer guide. </div>
Java documentation for android.bluetooth.BluetoothAdapter
.
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.
Fields
ActionConnectionStateChanged |
Intent used to broadcast the change in connection state of the local Bluetooth adapter to a profile of the remote device. |
ActionDiscoveryFinished |
Broadcast Action: The local Bluetooth adapter has finished the device discovery process. |
ActionDiscoveryStarted |
Broadcast Action: The local Bluetooth adapter has started the remote device discovery process. |
ActionLocalNameChanged |
Broadcast Action: The local Bluetooth adapter has changed its friendly Bluetooth name. |
ActionRequestDiscoverable |
Activity Action: Show a system activity that requests discoverable mode. |
ActionRequestEnable |
Activity Action: Show a system activity that allows the user to turn on Bluetooth. |
ActionScanModeChanged |
Broadcast Action: Indicates the Bluetooth scan mode of the local Adapter has changed. |
ActionStateChanged |
Broadcast Action: The state of the local Bluetooth adapter has been changed. |
Error |
Sentinel error value for this class. |
ExtraConnectionState |
Extra used by
|
ExtraDiscoverableDuration |
Used as an optional int extra field in |
ExtraLocalName |
Used as a String extra field in |
ExtraPreviousConnectionState |
Extra used by
|
ExtraPreviousScanMode |
Used as an int extra field in |
ExtraPreviousState |
Used as an int extra field in |
ExtraScanMode |
Used as an int extra field in |
ExtraState |
Used as an int extra field in |
Properties
Address |
Returns the hardware address of the local Bluetooth adapter. |
BluetoothLeAdvertiser |
Returns a |
BluetoothLeScanner |
Returns a |
BondedDevices |
Return the set of |
Class |
Returns the runtime class of this |
DefaultAdapter |
Get a handle to the default local Bluetooth adapter. |
DiscoverableTimeout | |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
IsDiscovering |
Return true if the local Bluetooth adapter is currently in the device discovery process. |
IsEnabled |
Return true if Bluetooth is currently enabled and ready for use. |
IsLe2MPhySupported |
Return true if LE 2M PHY feature is supported. |
IsLeCodedPhySupported |
Return true if LE Coded PHY feature is supported. |
IsLeExtendedAdvertisingSupported |
Return true if LE Extended Advertising feature is supported. |
IsLePeriodicAdvertisingSupported |
Return true if LE Periodic Advertising feature is supported. |
IsMultipleAdvertisementSupported |
Return true if the multi advertisement is supported by the chipset |
IsOffloadedFilteringSupported |
Return true if offloaded filters are supported |
IsOffloadedScanBatchingSupported |
Return true if offloaded scan batching is supported |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
LeMaximumAdvertisingDataLength |
Return the maximum LE advertising data length in bytes, if LE Extended Advertising feature is supported, 0 otherwise. |
MaxConnectedAudioDevices |
Get the maximum number of connected devices per audio profile for this device. |
Name |
Get the friendly Bluetooth name of the local Bluetooth adapter. |
PeerReference | (Inherited from Object) |
ScanMode |
Get the current Bluetooth scan mode of the local Bluetooth adapter. |
State |
Get the current state of the local Bluetooth adapter. |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
Methods
CancelDiscovery() |
Cancel the current device discovery process. |
CheckBluetoothAddress(String) |
Validate a String Bluetooth address, such as "00:43:A8:23:10:F0" |
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
CloseProfileProxy(ProfileType, IBluetoothProfile) |
Close the connection of the profile proxy to the Service. |
Disable() |
Turn off the local Bluetooth adapter—do not use without explicit user action to turn off Bluetooth. |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Enable() |
Turn on the local Bluetooth adapter—do not use without explicit user action to turn on Bluetooth. |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
GetProfileConnectionState(ProfileType) |
Get the current connection state of a profile. |
GetProfileProxy(Context, IBluetoothProfileServiceListener, ProfileType) |
Get the profile proxy object associated with the profile. |
GetRemoteDevice(Byte[]) |
Get a |
GetRemoteDevice(String) |
Get a |
GetRemoteLeDevice(String, Int32) | |
IsLeAudioBroadcastAssistantSupported() |
Returns |
IsLeAudioBroadcastSourceSupported() |
Returns |
IsLeAudioSupported() |
Returns |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
ListenUsingInsecureL2capChannel() |
Create an insecure L2CAP Connection-oriented Channel (CoC) |
ListenUsingInsecureRfcommWithServiceRecord(String, UUID) |
Create a listening, insecure RFCOMM Bluetooth socket with Service Record. |
ListenUsingL2capChannel() |
Create a secure L2CAP Connection-oriented Channel (CoC) |
ListenUsingRfcommWithServiceRecord(String, UUID) |
Create a listening, secure RFCOMM Bluetooth socket with Service Record. |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
SetName(String) |
Set the friendly Bluetooth name of the local Bluetooth adapter. |
StartDiscovery() |
Start the remote device discovery process. |
StartLeScan(BluetoothAdapter+ILeScanCallback) |
Obsolete.
Starts a scan for Bluetooth LE devices. |
StartLeScan(UUID[], BluetoothAdapter+ILeScanCallback) |
Obsolete.
Starts a scan for Bluetooth LE devices. |
StopLeScan(BluetoothAdapter+ILeScanCallback) |
Obsolete.
Stops an ongoing Bluetooth LE device scan. |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |