What is different BluetoothManager#getAdapter() and BluetoothAdapter#getDefaultAdapter()?

Viewed 685

I'm trying to implement a BluetoothLeScan.

But I don't know what is different BluetoothManager#getAdapter() and BluetoothAdapter#getDefaultAdapter().

I found out BluetoothManager#getAdapter() invokes BluetoothAdapter#getDefaultAdapter().

But BluetoothManager#getAdapter() injects context into BluetoothAdapter instance.

What difference does this make?

If you look at the developer documents, it says

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."

But They are using both methods in the example.

https://developer.android.com/guide/topics/connectivity/bluetooth#Profiles

https://developer.android.com/guide/topics/connectivity/bluetooth-le#setup

Bluetooth -> use BluetoothAdapter#getDefaultAdapter()
Bluetooth Low Energy -> use BluetoothManager#getAdapter()

Is that right??

Please let me know....

0 Answers
Related