Bluetooth smart support android

Bluetooth Smart (4.0) / GATT support in Android 4.0?

I’m trying to find way to work with Bluetooth 4.0 (AKA Bluetooth Smart) devices using modern Android smartphones, namely — HTC One V.

As I understood, there is some issues using GATT profile even in Android 4.0 with Bluetooth 4.0 hardware because of API limitations.

I saw Motorola released it’s own API for BT LE, but not sure it will work for other vendors. My goal is to get universal support for all smartphones with appropriate hardware.

Any suggestion for solution are highly appreciated.

PS: Yes, I saw Android API for HDP, but it seems to be used only with ‘classic’ Bluetooth devices (not low energy ones, as BT LE does).

AlexeyVMP

People also ask

This class provides Bluetooth GATT functionality to enable communication with Bluetooth Smart or Smart Ready devices. To connect to a remote peripheral device, create a BluetoothGattCallback and call BluetoothDevice#connectGatt to get a instance of this class.

GATT is an acronym for the Generic ATTribute Profile, and it defines the way that two Bluetooth Low Energy devices transfer data back and forth using concepts called Services and Characteristics.

Once your app has permission to use Bluetooth, your app needs to access the BluetoothAdapter and determine if Bluetooth is available on the device. If Bluetooth is available, the device will scan for nearby BLE devices.

2 Answers

Unfortunately there are no Android native GATT APIs simply because Android currently does not support Bluetooth Low Energy at all. This may change in upcoming Android releases, but today manufacturers instead integrate 3rd party Bluetooth stacks with Low Energy support from vendors like Qualcomm, Broadcom or CSR. Those come with their own set of APIs, obviously limiting compatibility to the set of phones using that particular vendor’s stack. The good news is that on other platforms like iOS or Windows 8 there are native GATT BLE APIs, and those are well supported. For Android, we will have to wait until Google decides to integrate the Linux/BlueZ work that has been done on BLE with Android.

introiboad

After some research I can only say this:

  • Motorola has sided with Broadcom to develop a proprietary API. It would seem it is extremely limited since it states there’s support for existing profiles only. Check it out here.
  • Samsung fails to provide any information regarding its BLE API, which I can verify exists and is called samsung.bluetoothle. I actually decompiled some apps from Google Play that use the SGSIII’s BLE capabilities and found a couple of methods that do not exist in Android’s native BT API, and they’re names clearly state they’re BLE related. I’ve tried using them through java reflection and am currently working out the possibility of developing a library. But tests I’ve run so far have had shakey results at best. There is also a thread on Samsung’s developer forum, I would suggest making some pressure here if you’re interested.
  • Google has made almost no remarks in this aspect. There’s a thread regarding this issues in the Galaxy Nexus, which you should star, with a lot of people complaining. The closest thing to an answer from Google can be found here.
Читайте также:  Ниссан тиида включить блютуз

Samsung has also modified a couple of Android’s classes, more especifically:

Since I’ve put this issue aside for a while due to lack of support from both Google and Samsung I’ll post what I’ve learned so far:

BluetoothAdapter new methods:

public boolean android.bluetooth.BluetoothAdapter.leTestEnd() public boolean android.bluetooth.BluetoothAdapter.setAvStreaming(boolean) public boolean android.bluetooth.BluetoothAdapter.setScanLE(boolean) public void android.bluetooth.BluetoothAdapter.setScoPathChange(int) public boolean android.bluetooth.BluetoothAdapter.startLeDiscovery() 

To use them do the following:

BluetoothAdapter ba = new BluetoothAdapter(); Method starteLeDiscoveryMethod = null; starteLeDiscoveryMethod = ba.class.getMethod("startLeDiscovery"); starteLeDiscoveryMethod.invoke(ba); 

NOTE: This method in particular works somewhat like the regular startDiscovery() method but, at least for me, it discovers the BLE device 2 out of 5 times. And remember, this is only for the SGSIII. I haven’t gotten around to extracting the new methods in BluetoothDevice but when I do, I’ll post them here.

Moises Jimenez Avatar

answered Nov 10 ’22 12:11

Источник

Bluetooth Smart (4.0) / GATT support in Android 4.0?

I’m trying to find way to work with Bluetooth 4.0 (AKA Bluetooth Smart) devices using modern Android smartphones, namely — HTC One V. As I understood, there is some issues using GATT profile even in Android 4.0 with Bluetooth 4.0 hardware because of API limitations. I saw Motorola released it’s own API for BT LE, but not sure it will work for other vendors. My goal is to get universal support for all smartphones with appropriate hardware. Any suggestion for solution are highly appreciated. Alexey PS: Yes, I saw Android API for HDP, but it seems to be used only with ‘classic’ Bluetooth devices (not low energy ones, as BT LE does).

Here is an official statement about BLE from Google employees at the latest IO developers.google.com/events/io/sessions/326240948 All devices with 4.3 and BLE hardware will have the official Android BLE API, which is demonstrated at this video session.

6 Answers 6

Unfortunately there are no Android native GATT APIs simply because Android currently does not support Bluetooth Low Energy at all. This may change in upcoming Android releases, but today manufacturers instead integrate 3rd party Bluetooth stacks with Low Energy support from vendors like Qualcomm, Broadcom or CSR. Those come with their own set of APIs, obviously limiting compatibility to the set of phones using that particular vendor’s stack. The good news is that on other platforms like iOS or Windows 8 there are native GATT BLE APIs, and those are well supported. For Android, we will have to wait until Google decides to integrate the Linux/BlueZ work that has been done on BLE with Android.

Читайте также:  Беспроводная bluetooth система vikefon

Thank you. Could you please provide vendors that proposes custom BT LE Android SDK for their platforms? (except Motorola)

I actually decompiled some apps from Google Play that use the SGSIII’s BLE capabilities and found a couple of methods that do not exist in Android’s native BT API, and they’re names clearly state they’re BLE related. I’ve tried using them through java reflection and am currently working out the possibility of developing a library. But tests I’ve run so far have had shakey results.

After some research I can only say this:

  • Motorola has sided with Broadcom to develop a proprietary API. It would seem it is extremely limited since it states there’s support for existing profiles only. Check it out here.
  • Samsung fails to provide any information regarding its BLE API, which I can verify exists and is called samsung.bluetoothle. I actually decompiled some apps from Google Play that use the SGSIII’s BLE capabilities and found a couple of methods that do not exist in Android’s native BT API, and they’re names clearly state they’re BLE related. I’ve tried using them through java reflection and am currently working out the possibility of developing a library. But tests I’ve run so far have had shakey results at best. There is also a thread on Samsung’s developer forum, I would suggest making some pressure here if you’re interested.
  • Google has made almost no remarks in this aspect. There’s a thread regarding this issues in the Galaxy Nexus, which you should star, with a lot of people complaining. The closest thing to an answer from Google can be found here.

Samsung has also modified a couple of Android’s classes, more especifically:

Since I’ve put this issue aside for a while due to lack of support from both Google and Samsung I’ll post what I’ve learned so far:

BluetoothAdapter new methods:

public boolean android.bluetooth.BluetoothAdapter.leTestEnd() public boolean android.bluetooth.BluetoothAdapter.setAvStreaming(boolean) public boolean android.bluetooth.BluetoothAdapter.setScanLE(boolean) public void android.bluetooth.BluetoothAdapter.setScoPathChange(int) public boolean android.bluetooth.BluetoothAdapter.startLeDiscovery() 

To use them do the following:

BluetoothAdapter ba = new BluetoothAdapter(); Method starteLeDiscoveryMethod = null; starteLeDiscoveryMethod = ba.class.getMethod("startLeDiscovery"); starteLeDiscoveryMethod.invoke(ba); 

NOTE: This method in particular works somewhat like the regular startDiscovery() method but, at least for me, it discovers the BLE device 2 out of 5 times. And remember, this is only for the SGSIII. I haven’t gotten around to extracting the new methods in BluetoothDevice but when I do, I’ll post them here.

Источник

Bluetooth Smart (4.0) / GATT support in Android 4.0?

As discovered, 4.3 has support for BLE, but it so broken, especially on Nexus devices. At my opinion, it’s not ready for production.

Solution 2

Unfortunately there are no Android native GATT APIs simply because Android currently does not support Bluetooth Low Energy at all. This may change in upcoming Android releases, but today manufacturers instead integrate 3rd party Bluetooth stacks with Low Energy support from vendors like Qualcomm, Broadcom or CSR. Those come with their own set of APIs, obviously limiting compatibility to the set of phones using that particular vendor’s stack. The good news is that on other platforms like iOS or Windows 8 there are native GATT BLE APIs, and those are well supported. For Android, we will have to wait until Google decides to integrate the Linux/BlueZ work that has been done on BLE with Android.

Читайте также:  Smart buy sbs 4430 solid bluetooth bass boost портативная

Solution 3

After some research I can only say this:

  • Motorola has sided with Broadcom to develop a proprietary API. It would seem it is extremely limited since it states there’s support for existing profiles only. Check it out here.
  • Samsung fails to provide any information regarding its BLE API, which I can verify exists and is called samsung.bluetoothle. I actually decompiled some apps from Google Play that use the SGSIII’s BLE capabilities and found a couple of methods that do not exist in Android’s native BT API, and they’re names clearly state they’re BLE related. I’ve tried using them through java reflection and am currently working out the possibility of developing a library. But tests I’ve run so far have had shakey results at best. There is also a thread on Samsung’s developer forum, I would suggest making some pressure here if you’re interested.
  • Google has made almost no remarks in this aspect. There’s a thread regarding this issues in the Galaxy Nexus, which you should star, with a lot of people complaining. The closest thing to an answer from Google can be found here.

Samsung has also modified a couple of Android’s classes, more especifically:

Since I’ve put this issue aside for a while due to lack of support from both Google and Samsung I’ll post what I’ve learned so far:

BluetoothAdapter new methods:

public boolean android.bluetooth.BluetoothAdapter.leTestEnd() public boolean android.bluetooth.BluetoothAdapter.setAvStreaming(boolean) public boolean android.bluetooth.BluetoothAdapter.setScanLE(boolean) public void android.bluetooth.BluetoothAdapter.setScoPathChange(int) public boolean android.bluetooth.BluetoothAdapter.startLeDiscovery() 

To use them do the following:

BluetoothAdapter ba = new BluetoothAdapter(); Method starteLeDiscoveryMethod = null; starteLeDiscoveryMethod = ba.class.getMethod("startLeDiscovery"); starteLeDiscoveryMethod.invoke(ba); 

NOTE: This method in particular works somewhat like the regular startDiscovery() method but, at least for me, it discovers the BLE device 2 out of 5 times. And remember, this is only for the SGSIII. I haven’t gotten around to extracting the new methods in BluetoothDevice but when I do, I’ll post them here.

Solution 4

SDK 18 has support for it now. Docs are here:

Testing on my Nexus 4 is crashing the bluetooth stack.

Solution 5

HTC has had BLE support since last year with HTC One X+, Droid DNA and of course the HTC One. Initially the HTC BLE API was upon request but it’s now been freely downloadable at http://htcdev.com.

Yes the new standard Android BLE API from Google in Android API Level 18 is coming very soon (see preview from IO video) — but you can wrap third party APIs (HTC, Samsung, etc) in a compatible way to support the new standard API as all the APIs are quite similar in their support of the GATT profile (similar to IOS).

Источник

Оцените статью
Adblock
detector