Bluetooth Low Energy API for Jelly Bean 4.2
Asked Answered
H

2

9

After hours of research on the BLE topic and android, the only thing that I've found is a big mess. Developing an app for iOS, which uses BLE was quite simple - one framework and a few documentations. Now, I have to write an app for android Jelly Bean 4.2.2 (the app can work on just one device, which ships currently only with 4.2.2) which has to discover and connect to BLE devices.

I found out, that until 4.1 the bluetooth stack on android is called BlueZ, but with 4.2 Google changed to a stack from Broadcom. I know that with 4.3 there's an official and built in support for Bluetooth Low Energy in android, but the app has to run under 4.2.2.

After a lot of research, I haven't found any documentation about the Broadcom stack. Can someone point me to a link (which is still working and doesn't end in a 303 error)? Does the stack has BLE support and does someone know a tutorial on that or could provide a few lines of sample code?

Thank you very much for any inputs! I'm really lost in that mess

Linard

Headpin answered 2/12, 2013 at 15:50 Comment(7)
Exactly. With 4.3 it's no problem at all and the SDK is quite similar to CoreBlutooth from Apple for iOS. I made a test app for 4.3 which should scan for devices, but I don't have a device running 4.3 yet. But at the end the app has to run under 4.2.2.Headpin
i don't understand why someone would put a BLE chip on a device that runs an OS that cannot use it.Agonistic
And I don't understand why Google hasn't released a BLE SDK 1 or 2 years ago instead of changing the stack 3 times in 3 android versionsHeadpin
did you asked them (ruggear) if they have a specific api for accessing the BLE stack?Agonistic
(Also, are you sure their stack (as there is no obligation to use the stack provided by google) does support BLE?)Agonistic
@njzk2: I haven't thought of that. Thank you very much, I will ask them asap. I thought such a small vendor wouldn't create an own stack...Headpin
(to comment on my previous previous comment, the nexus4 used to ship with a BLE chip but android 4.1 only. It didn't make sense at the time either.)Agonistic
H
11

After 3/4 year and many views I wanna answer the question by myself:

We talk with the chinese manufacturer but they couldn't give us a release date for JB 4.3 (at the moment it looks like that a hardware upgrade is necessary 😂). Therefore we searched for another solution and we found one: BlueKitchen GmbH (http://bluekitchen-gmbh.com), a small company which has developed BTStack, an open source Bluetooth stack for jailbroken iOS devices and embedded systems, has modified their existing stack to make it compatible with our specific Android device. Involved in the solution is rooting the device, replacing the original Bluetooth stack with our custom one, unrooting the device and then shipping it to our customers. Because the stack runs as a system service independent from the application, the application doesn't need any root rights and can be easily installed and updated via the Google Play Store or the ADB console without rooting. The application talks with the stack through a socket connection and therefore can use plain Java code. Inside the application one has to distinguish between the custom stack and a device running JB 4.3+ with the native BLE stack. But because the BLE protocol dictates the APIs, everything is very similar.

Feel free to ask me about the implementation of that stack inside an application and contact BlueKitchen if you are interested in that stack version for the iSafe Innovation 2.0 or Ruggear RG220 device or if you want a stack for another Android device (with a BLE chip)

I hope you can find a solution too

Linard

Headpin answered 22/9, 2014 at 12:39 Comment(0)
P
1

You could work with the Samsung BLE SDK, which is now deprecated AFAIK. If I recall, it used either TI or Broadcom. Of course, that will only work on some Samsung devices.

I wrote a wrapper for BLE that switched between Samsung's SDK to 4.3+'s SDK depending on availability, but it was for a client so I can't release it unfortunately.

Priebe answered 2/12, 2013 at 15:55 Comment(11)
Thank you for your fast comment. The device a kinda special one: ruggear.com.sg/products/isafe-innovation-2-0 and I don't think that it will support a Samsung SDK. Where can I find additional information on the TI and Broadcom SDK?Headpin
that link mentions 4.1.2 as android version, btw, not 4.2.2Agonistic
I know. The manufacturer confirmed that the device ships with 4.2.2, but thank you @Agonistic for your commentsHeadpin
if so, may be they consider upgrading to 4.3 sometime in the future?Agonistic
They told me that 4.3 should be supported, but there's no 4.3 update scheduled and I can't expect that everyone roots his device to run my app ;)Headpin
@Jon Willis: You mentioned in your answer a TI SDK. I just googled for that and the only thing I've found is the Bluetooth SensorTag Kit (processors.wiki.ti.com/index.php/Bluetooth_SensorTag). Could you please provide me a link to the TI SKD or documentation? Thank you very much LinardHeadpin
@Jon Willis: Another question just popped up after watching Google I/O 2013 about best practice for bluetooth development. At 9:12 (youtu.be/EC5-cEbr520?t=9m12s), they are saying that BLE was not supported yet and will be introduced in 4.3. What exactly does that mean? Is only the default android SDK not supporting BLE or are all bluetooth SDK's not able to communicate with BLE devices? Thank you for any clarification LinardHeadpin
@Linard Android's SDK doesn't have support for BLE prior to 4.3. Third party libraries can enable BLE on Android 4.2 and lower where the device's hardware supports BLE, such as on Samsung's S III, 4 and Note 2 and on the HTC One. I only have experience using Samsung's SDK on 4.2 (which is now deprecated), so I can't really help you further. I can't reiterate enough-- there is no standard BLE support on Android 4.2 and lower. You'll need to use third party solutions on a per-device basis.Priebe
@JonWillis: Thank you very much for this clarification. I know now at least that it might be possible with 3rd party SDK... This doesn't answer my question right now, but helps a bit finding a suitable SDKHeadpin
@Linard you may want to change your requirements. Why are you targeting 4.2? -- you're going to have a bad time getting BLE globally supported below 4.3 (and there's even bugs on 4.3). Is this a public app or is it an enterprise app where you can prescribe or at least target specific hardware?Priebe
@JonWillis: the app should run on just one device (like an enterprise app), but it will be public. But I and the company that I'm working for doesn't care about other devices, because it should run on just that single device that ships with 4.2.2. I found on a google group a small code snippet, that will "scan" the device for available bluetooth SDKs from Samsung, Broadcom, Motorola, etc. I will give a try over the weekend to find a SDK and to look deeper into that SDK or contact the manufacturer, if he has an own SDK... Thank you for your help!Headpin

© 2022 - 2024 — McMap. All rights reserved.