This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Android and Bluetooth Smart - It works on the Samsung S3 phone

Other Parts Discussed in Thread: CC2540, CC2541, BLE-STACK, SENSORTAG-SW

I found a nice Simple Android application you can use to test your hardware or just evaluate TI sample  apps advertisment parameters.

1. Use CC2540 for Packet Sniffing from the Mini Kit
2. Download the Bluetooth Smart Scanner from Google Play : https://play.google.com/store/apps/details?id=com.semilink.smartscanner&feature=search_result
3. Try to adjust the parameters, and test again.

I programmed our Keyfob with for example the Bloodpressure sensor, and tested it out.

However, now it is time to write our own Samsung S3 Android BLE App.

Enjoy,
LPRF Rocks the World

 

  • Just a little fun test with my Samsung S3 phone again to see that Android and Bluetooth Smart works....

    Even still with no Android common Bluetooth Smart API, it still works.  I am able to play with my sensorTag, and see that it is detected by the Bluetooth Smart Scanner.  It shows up in the scan discovery device list.

    I even downloaded our Competitor Android App. (do not need to mention name) and tested it with my SensorTag.
    It connected and started to transmit data, but  the app crashed and did reset my phone.... Interesting

    Use the CC2540 with our TI Packet Sniffer to see the captured traffic.

    Enjoy,  
    LPRF Rocks the World  

  • As far as I understand the Android Bluetooth API can scan and show BLE devices but does not provide any GATT functions. I have seen our BLE devices show up on an HTC one x when scanning without any app installed. I would not consider this to be "working" unless data can be exchanged via GATT. Does anyone know when GATT will be added to Android, or has anyone worked successfully with the Broadcom BLE API on Samsung devices?

  • Yes, you are probably right.
    If you investigate the Samsung Developers forum, they provide some hints about their support, and it is coming.

    Samsung Developers Forum

    I am looking forward to the full support for Android.

    LPRF Rocks the World

  • I just decided to investigate this a little bit further, and will continue the effort to discover the GATT support.
    I downloaded the Android BCM BLE SDK and the examples  for my Eclipse workspace.

    I had a few hick ups to get to point where I was able to successfully download, and debug over adb.
    I need to modify the manifest file to overcome the "INSTALL_FAILED_MISSING_SHARED_LIBRARY" by setting the
    <uses-library android:name="com.broadcom.bt.le" android:required="false" />

    As a starting point I just downloaded  the Time Server example on my S3 phone, and tested discovery against the SensorTag.
    Next step will be to dig deeper and discover what  this API offer of Bluetooth Smart Support

    Open Bluetooth Low Energy SDK for Android Implementation

     Android BLE Framework

    Enjoy,
    LPRF Rocks the World

     

  • Dear Community,

    If anyone is interested in working on this, let me know.
    The first major E2E contributor to contact me will receive a TI CC2540DK, CC2541 Mini DK, and SensorTag kit, so we can get an app up and running.

    Please contact me via this forum if interested

    LPRF Rocks the World

  • Here is another cool gadget and example that S3 seems to work:

    http://www.indiegogo.com/sticknfind

    Are nobody interested in three free TI Blutooth Smart Kits? Interesting

    LPRF Rocks the World

  • We'll have a look, but can't promise anything on timescales.

    We've got our stuff working on the iPhone and have just purchased an S3 to start porting.

    Feel free to send us the kits, we already have some - but it can help to have some extras.

    Thanks,

    Ben

  • Actually, I'm working on getting the S3 to work with the CC2540 for my final year project. 

    (Haha, yeah I'm an undergrad, hope that doesn't reduce the likelyhood of me getting help from this forum :) )

    Anyway, I'm making use of the com.samsung.bluetoothle api and have the following things working.

    1. Scanning for Bluetooth LE devices.

    2. Pairing with a Bluetooth LE device. However, this is still somewhat intermittent and might even cause the entire phone to auto restarts when it fails.

    3. Reading/Writing an attribute. (Only works with 128 bit UUIDs)

    4. Receiving notifications.

    However, I can't seem to be able to write to the characteristic attribute. (The attribute that you write 01:00 to, to get the CC2540 to start sending notifications) I've simply worked around this by creating an additional attribute and writing a value to it.

    Anyway, not sure how much this is worth since I'm a student, but I don't mind sharing my code, especially if someone can help me improve it :)

  • I stumbled upon this issue when playing around with the Broadcom SDK and the five supplied examples. Please also note that BLE devices previously found by Smart Bluetooth Scanner or nRf Studio will appear in the device list. See the file 'DeviceListActivity.java'. Effectively this class (on my S3) only sees standard BT devices + paired BLE devices. I also noticed that the examples and 'com.broadcom.bt.le' in the Git repository are quite old. So somehow Smart Bluetooth Scanner and nRf Studio must use newer versions? Could it be from one of the numerous clones, and in that case which? Many of them seem to be much more active than the original.

  • Thank you, rswl88, and Ben Scammell!
    Please make me a friend, so we can share information for me to send you kits.
    Whatever you are willing to share with our E2E would be great.

    Thank you,
    LPRF Rocks the World

  • There is another option available to be investigated using Dbus.

    https://github.com/android-btle/framework

    LPRF Rocks the World

  • I don't really need the kit but I do want the SensorTag. My local distributor told me that it would take 2-3 months to get it imported and I think by that time I would have already made one by myself. Our proximity tag is already in mass product ion and you can find our application MIMU in Apple's app store. Our customers are chasing us everyday about the application for Android. And as far as we know, even the Broadcom API is not so stable and is not suitable for a commercial application. Anyway we have almost finished our Android application and is just waiting for the final working API to be released someday in the near future. Our code currently is based on BR API (cause we have a BR version of proximity tag too). I guess it would take much effort to port it to support BLE.

  • rswl88 - how did you get access to the com.samsung.bluetoothle api?

    I need to do something very similar to what you have got going but I don't know how to get access to the libraries - if you could show som eof the code would be great!

    Cheers.

  • Correct me if I'm wrong but this framework requires rooting ...

  • I'm very interested in making the broadcom stack working on my S3 mini.. with the current stack my app is crashing on a "no method found" -> getDeviceType...

    Any link to a more recent repository ?

    Would be really great to share experience on this topic :)

  • It is very good that we can share these experiences on our E2E to get our SensorTag Android App up and running. 

    A colleague provided me with a nice link to the source for the Broadcom driver, BlueDroid

    https://android.googlesource.com/platform/external/bluetooth/bluedroid/

    This is available if anyone wants to dig deeper into the Linux world.

    LPRF Rocks the World

  • Try to google "create-a-connection-to-a-bluetoothle-device-using-galaxy-s3"

    LPRF Rocks the World

  • Is there any sample code available for Samsung S3. I can see multiple apps on the store able to detect BLE device but I can not find any sample code....and the broadcom SDK seems not working for the S3 (getDevice method not found)....

    Can someone help me ? 

  • Hi guys,

    I've clobbered together an app that should enable communication of galaxy S3 with simpleBLEperipheral.

      

    I am only able to get it to work 8/10 times, and I am sharing the source code in the hopes that someone more experienced is able to help make it more stable.

       

    Communication with BLE is done through the com.samsung.ble api. No rooting of the phone is required. I've obtained the necessary API through the de-compilation of the galaxy S3 firmware. My S3 model is GT-I9300, android version is 4.1.2, build number is JZO54K.I9300XXEMA2. Not sure if this is required to ensure the proper working of this hidden API.

     

    Here are the files: 8880.S3 BLE.zip

     

    Instructions for use:

    1. Ensure that you are running android 4.1.2 on your S3.
    2. Install the SimpleBLEPeripheral/SimpleBLEPeripheral.apk on your S3.
    3. Program the modified SimpleBLEPeripheral onto an CC2540 development board.
    4. Run the app.
    5. Start off with discovering/pairing of the device and then mess about with the read/write/notification features. I would say that reading data is the least stable out of the 3. Try using the writing/notification features first before reading.
    6. Sometimes there is difficulty in pairing with the device. Try pairing for a few times and it might work. (It takes 2 tries to successfully pair for me)
    7. The app/phone might crash occasionally, please restart the phone and try again.

    Hope it works for you! :)

  • Tx for sharing this code. It is very useful.

    I need to read the advertising data in addition to the RSSI.

    In iOS the advertising data are returned as a map of key/values where we can read on the advertising data (device name, power, ...)

    How to read those parameters with this library ?

    Tx for your help

    -Fred

  • Fred Visticot said:

    Tx for sharing this code. It is very useful.

    I need to read the advertising data in addition to the RSSI.

    In iOS the advertising data are returned as a map of key/values where we can read on the advertising data (device name, power, ...)

    How to read those parameters with this library ?

    Tx for your help

    -Fred

    Oh, if it is just reading the advertising data such as the name and RSSI, no access to com.samsung.ble package is needed. You can refer to DiscoveryActivity.java for the sample code. Basically, you register a broadcast receiver for android.bluetooth.device.action.FOUND, and then call the hidden BluetoothAdapter.startLeDiscovery() through reflection. (Refer to BluetoothAdapterHidden.java)

    This is very stable and will definitely work. 

  • Tx,

    - I can start the scan with starLeDiscovery

    - the onReceive callback is called

    - I can read the RSSI of the BLE device with:

    short s = paramAnonymousIntent.getShortExtra("android.bluetooth.device.extra.RSSI", (short)0);

    BUT how to read other advertising data (devicename, and manufacturedData by example) ?

  • Any news regarding getting advetising data from the BLE API ?

    It is so simple from the iOS side :)

    Tx for the support..

    -Fred

  • BluetoothDevice localBluetoothDevice = (BluetoothDevice)paramAnonymousIntent.getParcelableExtra("android.bluetooth.device.extra.DEVICE");
    localBluetoothDevice.getAddress();

      

    Not sure how to obtain the maunfacturing data.

  • Hello,

    I have read all the posts in this topic it is still confusing. There are several links but at the end I am not sure which one is working robustly? I have been developing iOS apps for BLE but I am seriously considering switching to Android.

    http://android-btle.github.com/framework/ and https://code.google.com/p/broadcom-ble/ are these the same?

    I hope the first one is working fine with S3. I am mostly interested in this function public void setScanParameters(int scanInterval, int scanWindow) iOS does not let changing scan parameters.

    Also there is this link that explains the situation of Android support. It is making me even more confused. Appearently somethings completely changed on BT Stack with the release of Android 4.2

    http://www.kickstarter.com/projects/cuckoo/cookootm-the-watch-for-the-connected-generation/posts/352332

  • Ok, after a long way research on the WWW I came up with the following conclusions.

    Cagatay Ulusoy said:
    http://android-btle.github.com/framework/ and https://code.google.com/p/broadcom-ble/ are these the same?

    yes, They are the same

    Android 4.2 changed complete Bluetooth stack from BlueZ to Bluedroid in cooperation with Broadcom. 

    Bluedroid is the new default BT stack for Android 4.2. Andorid will no longer use BlueZ stack. With Android 4.2 there are major changes to BT subsytem architecture. Bbluedroid is using a completely new BT stack which is based on contributions from Broadcom. They make some of nice changes by adding abstraction layers. HAL API is added that provides callbacks such as getting adapter properties, device properties etc. Bluedroid doesn’t use HCI interface and BT kernel subsystem. However... still no LE framework API. Here is the press release (http://www.broadcom.com/press/release.php?id=s721534).

    It should be noted that there are missing functions and headers related to BLE in BlueDroid open source. However, enabling related flags results in build error. Looks like Broadcom just removed LE support before open sourcing it (Video: http://www.youtube.com/watch?v=eKQtSjjfNsA). 

    Let's cross the fingers for Google IO - will take place from May 15 to May 17 2013. Someone on the web said that: "Given that Google announced Android 4.1 Jelly Bean at 2012's IO conference, it's not unreasonable to expect to see Android 5.0 at this year's event. There is no official word yet whether Android 5 would be ready for a full introduction by May 2013."

    On the other hand, I downloaded the competitor Android app (do not need to mention name) also. It communicates with my Bluegiga dongle and exchanges data for Heart Rate Service.

    What I want to know is "What is the current situation of Broadcom API?" Did you give up or are you still working on it?

    I am very excited to hear your input :)

    Regards,

  • Thank you for contribution, Cagatay.
    It is a very interesting topic, and a lot of frustration with this SDK. 
    As you, I hope Google IO this year can help provide some more answers.

    I am still continuously investigating.

    LPRF Rocks the World

  • Hi,

    In our research group we officially decided to switch from iOS to Android after discussions. It is mainly because iOS CoreBluetooth API is quite high level. It is not good for research purposes since it does not allow you set the parameters such as scan interval and scan window. For example the scan window on the foreground is 30 millseconds and scan interval is 40 milliseconds. Using NSTimers to adjust the window is not a solution as we observed from the power traces. 

    Now for us, the question is whether using BlueZ 5.0 API or Broadcom BLE SDK. I will update this thread as long as I have new updates of Android. We will be building app for Samsung Galaxy SIII.

    Regards,

  • Very good!

    I assume you have a TI SensorTag kit, right?
    This can be used for your research, and application development.

    Let me know if you do not.

    LPRF Rocks the World

  •  Hi,

    In our research group we currently don’t have TI SensorTag. Instead we are using CC2540 Mini Development Kit. We have not ordered it yet.

    Regards,

  • Cagatay Ulusoy said:

    On the other hand, I downloaded the competitor Android app (do not need to mention name) also. It communicates with my Bluegiga dongle and exchanges data for Heart Rate Service.

    What I want to know is "What is the current situation of Broadcom API?" Did you give up or are you still working on it?

    I was curious and downloaded the [un]mentioned application and tried to pair it with the sensor tag to see if I can get some temperature measurements. On a fully-updated SIII, it locked up the phone - then some watchdog timer kicked in and reset it.

  • Sign Bit said:

    I was curious and downloaded the [un]mentioned application and tried to pair it with the sensor tag to see if I can get some temperature measurements. On a fully-updated SIII, it locked up the phone - then some watchdog timer kicked in and reset it.

    I bought Samsung S3 three weeks ago. I already have Bluegiga USB dongles with Heart Rate Service. The connection was established between [un]mentioned app (Samsung S3) and Blugiga BLED112 without any problem and the packet exchange was successfully happening. I am attaching the sniffer output .psd file and the screenshot from samsung phone.

    I know it is illegal and I am a bad guy but I decompiled the [un]mentioned app. It is using the mysterious SDK or SW package named "samsung.bluetoothle" I don't know where it is released and where the documentation is. It is so strange that Samsung is saying nothing about it. If anyone has any idea about what it is and where I can find further info, please let me know.

    5861.heartRate.psd

  • It is actually being discussed on multiple forums where the SW package mentioned is the missing link:

    XDA Developer's
    Samsung Developer’s

    and the following app is also being mentioned build for the Korean made Pebble, BTLE proximity devices, which interfaces flawlessly to the Galaxy S3, it can discover connect and receive xxxalerts from the BTLE devices:

    Smart Nudge Anti-Loss BLE Tag

    LPRF Rocks the World

  • Hi.

    I'm using the TI CC2540 mini-kit, and have been able to get the keyfob paired up with my I9300. I used the sample-code from , where i flashed the keyfob with his custom .hex file. The pairing works, but i cannot send/write with the application to the keyfob. 

    I have been testing with Btool, and this worked great with the default-hex files that followed, but i still can't get this to work with th I9300.

    My main task with this testing is to read out battery information on the BLE-keyfob, and also be able to write/read throgh the TX/RX on the keyfob. 


    Been trying now for two days to figure it out but unfortunately im getting more & more confused. 

    If anyone have any input/clarifications i would be greatful. :) 

  • Does Ti has a Wilink jar file for Android? I hear that HTC ONE X use Tegra 3 & Ti Wilink solution in it, How to contact Ti asking for this jar file?

  • mikkemus said:

    Hi.

    I'm using the TI CC2540 mini-kit, and have been able to get the keyfob paired up with my I9300. I used the sample-code from , where i flashed the keyfob with his custom .hex file. The pairing works, but i cannot send/write with the application to the keyfob. 

    I have been testing with Btool, and this worked great with the default-hex files that followed, but i still can't get this to work with th I9300.

    My main task with this testing is to read out battery information on the BLE-keyfob, and also be able to write/read throgh the TX/RX on the keyfob. 


    Been trying now for two days to figure it out but unfortunately im getting more & more confused. 

    If anyone have any input/clarifications i would be greatful. :) 

    I need more details to help you.

    1. What version of android is your galaxy s3 running?
    2. What are the exact steps that you have performed that leads to the crash? Do you happen to have the logcat output from the phone?
  • I also had a go with this code a few weeks ago. Device discovery works fine, and from time to time I managed to connect. In the end I gave up, it was simply too unstable and I think it's a wast of time working on a BLE-stack (Samsung based on Broadcom) that hopefully will become obsolete when Google release official BLE support. 

  • rswl88 said:

    I need more details to help you.

    1. What version of android is your galaxy s3 running?
    2. What are the exact steps that you have performed that leads to the crash? Do you happen to have the logcat output from the phone?

    Hi rswl88. 
    I'm using version 4.1.2. 
    I think i haven't really understood the consept of UUID and it's here where the application fails when i try to write/read values to the keyfob. I tried to use some of the UUID values from the CC2450 MINI-kit manual, but none of these work when i'm using the SimplBLEPeripheral application. 

    Screenshot where application give error:  http://i.imgur.com/6yteBLC.png

  • Jomar Hønsi said:

    I also had a go with this code a few weeks ago. Device discovery works fine, and from time to time I managed to connect. In the end I gave up, it was simply too unstable and I think it's a wast of time working on a BLE-stack (Samsung based on Broadcom) that hopefully will become obsolete when Google release official BLE support. 

    Hello,

    Although, it looks like a waste of time, I am not giving up and still trying to find a way on Android side. There are several options as we all know. Motorola RAZR SDK is claimed to be stable but I found the API too basic. It doesn't let me configure parameters that I am seeking for. HTC also has BLE SDK addon named "addon-htc_opensense_ble_apis-htc-16". I was in contact with one of the HTC engineers and he said that he has stable connections and successful discovery. HTC One, HTC One X+, Droid DNA or Butterfly supports this SDK. However, these phones are quite expensive to get one so I couldn't test. I compared the documentation of HTC SDK and broadcom BLE SDK. HTC SDK looks like an extension to Broadcom-BLE. Most of the class names, methods and even the documentation are the same. However, HTC SDK has more built in profiles and different package names.

    When we come back to BLE-Broadcom, it is said to have problems and lack of some method implementations. However, on code.google.com there are clones of this API. Espcially, this one is worth checking: https://code.google.com/r/naranjomanuel-opensource-broadcom-ble/source/browse/ I might be wrong but as far as I read it combines Dbus API of BlueZ and Broadcom-BLE. According to the changelog of the author (https://code.google.com/r/naranjomanuel-opensource-broadcom-ble/source/list) he is able to read/write characteristics. I haven't checked it yet but it is worth. I will also update if it works.

  • The clone you mention could be interesting. What I've done for now is to concentrate on the apps higher layers, and then 'plug in' the BLE stuff when it becomes available.

  • mikkemus said:

    I tried to use some of the UUID values from the CC2450 MINI-kit manual, but none of these work when i'm using the SimplBLEPeripheral application. 


    You need to use 128-bit UUID values, instead of the default 16-bit UUIDs, that is why I provided a custom SimpleBLEPeripheral firmware for the cc2540.
  • rswl88 said:
    You need to use 128-bit UUID values, instead of the default 16-bit UUIDs, that is why I provided a custom SimpleBLEPeripheral firmware for the cc2540.

    Hi, 

    I' aware that you should use 128 bit, and looked on examples on how to write from 16-bit --> 128-bit, but it still dosen't work for me? 

    Do you have a UUID value that worked for you, so i can try on here and see what happens. 

    Thanks again rswl88.

    Michael.

     

  • mikkemus said:

    Hi, 

    I' aware that you should use 128 bit, and looked on examples on how to write from 16-bit --> 128-bit, but it still dosen't work for me? 

    Do you have a UUID value that worked for you, so i can try on here and see what happens. 

    Thanks again rswl88.

    Michael.

    The working UUIDs are already in SimpleBlePeripheralService.java.

  • Hello LPRF Rocks,

    Is there some reason why TI can't just call up Samsung, Google, or Anyone else and simply say, "we would like to have your phone work flawlessly with our CC2540/41 devices, please provide us with the information we need."

    What's the point of being Texas Instruments if you have to fiddle around to get something like this done?!

    Thanks

  • very good question. It might be not polite to ask here, but I wonder if I use the "competitor"'s chip, will they provide the source code for application on Anroid?

  • Maybe Google will fix the issues with the next Android or ...

    It's Google/Motorola v.s. Samsung for the upcoming smartWatch/wearables/fitness markets and all about differentiation of Android.

    Google IO should be very interesting this year! 

  • Rswl88,

    I need to acquire the same data as Fred--the RSSI and Service UUID from the Bluetooth LE advertisement packet.  I'm attempting to acquire the advertisement packet data using the backport API as you suggested and it is not working.  Do note, I just started Android development.  That said, is it necessary to use the Backport API to read Bluetooth LE advertisements?  Or can I use Android's built-in bluetooth API? 

    Appreciate any help you can offer.

    Thank you,

    Casey

  • Casey Graika said:

    Rswl88,

    I need to acquire the same data as Fred--the RSSI and Service UUID from the Bluetooth LE advertisement packet.  I'm attempting to acquire the advertisement packet data using the backport API as you suggested and it is not working.  Do note, I just started Android development.  That said, is it necessary to use the Backport API to read Bluetooth LE advertisements?  Or can I use Android's built-in bluetooth API? 

    Appreciate any help you can offer.

    Thank you,

    Casey

    You need com.ble.bluetoothle.BluetoothAdapterHidden.java and com.ble.bluetoothle.BluetoothDeviceHidden.java.

    As for any other advice, make sure that your phone is a samsung galaxy s3 or a note 2 running android 4.1.2.

  • Dear Sir,

    Do you know where I can download the

     com.samsung.bluetoothle ?

     

    Thank you and best regards,

    Tony

  • Tx for the info.

    Can you please provide more details regarding getting advertisement data ?

    I have checked the 2 classes (com.ble.bluetoothle.BluetoothAdapterHidden.java and com.ble.bluetoothle.BluetoothDeviceHidden.java) but I do not know how to retrieve advertisement data...


    It is so easy on iOS API that return an dictionary with RSSI, Advertisement data ...


    Fred