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

 

  • rswl88 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.

    [/quote]

    Rswl88,

    Thanks, I'll try this out today or tomorrow.  The one problem I may run into is that I'm using a Nexus 7.  They are suppose to support bluetooth 4.0 and they run a similar BT module as the Galaxy S3 (both made by Broadcom).  However, I don't know if this means it will work. 

    Fred:  I'll let you know if I get it working and provide a detailed description of how I did it. 

    Thanks,

    Casey

  • Is there any way to make android phone acts as peripheral? I make a search but found no one has done it.

  • I am very interested in working with everyone here and sharing information.

    I have an HTC One X+ which I have successfully bonded through the settings menu with a CC2540 in peripheral role using BTool. But I am not sure how to transmit data between them.

    Furthermore, I have written an android app that can discover the CC2540 using the broadcom API. However, I have not been successful when trying to connect using it for some reason. I keep getting a nullpointerexception at com.broadcom.bt.le.api.BleClientProfile.connect(BleClientProfile.java:425).

    And that is where I am at. I am not certain the CC2540 is broadcasting good advertising and response data. I would like it if it could trick other devices into thinking it is another phone or bluetooth keyboard or something. When I put a central profile on the CC2540, it never discovers any other device: not an iphone 4s, iphone 5, HTC One X+, nor a late 2012 iMac, all of which are ble-compatible and were in discoverable mode.

    Ultimately, I just want an android app on my HTC One X+ that can send some data to and from the CC2540 using BTool (and not just through manipulating the advertising data...). Can someone point me in the right direction?

  • Hi rswl88:

    Thanks for posting the file.  I noticed that when called BluetoothAdapterHidden.startLeDiscovery() it doesn't find any classic bluetooth devices.  I am writing an App that simultaneously reads surrounding Bluetooth devices and I'm trying to include BLE into the mix.  Any idea if it's possible to perform classic Bluetooth and BLE device discovery at the same time using your library?

    Thanks,

    Bill

  • @Casey: did you sucess to read advertisement packer. I really need this info...

    -Fred

  • Casey,

       Any result about your Nexus7 experience. I also want to use BLE on Nexus7, any input is appreicated.

       BTW, I plan to explore by using  broadcom-ble - Open Bluetooth Low Energy SDK for Android. But the link is broken.


      To download the SDK from within the Android SDK manager, follow the steps ... the following URL: http://broadcom-ble.googlecode.com/files/repository.xml 
      If anyone have downloaded it, pls give me some help. Thanks.
  • Hi LPRF,

       The old link  http://broadcom-ble.googlecode.com is broken. Can you help to send me Android BCM BLE SDK, Thanks lot My email is dull_boy@126.com.

  • Hi,

    JohnsonJiang said:
    The old link  http://broadcom-ble.googlecode.com is broken. Can you help to send me Android BCM BLE SDK, Thanks lot My email is dull_boy@126.com.

    I am attaching the repository file and the related OpenBleApi_r05 zip file which is issued in the repository.xml. To make it work, you should edit the URLs inside the repository.xml file. In order to build the project I modified the resources of the project because it was giving errors. Anyways, it is not working with my s3. It is giving getDeviceType error. Good luck and please let us know if you have progress. 

    2210.android_HelloBluetoothClient.rar

  • Hi LPRF and everybody.

    I have just joined to you because l am working on an android app for connecting to an external Bluetooth LE device with a Samsung Galaxy Note 2 N7100.

    I a bit confused with some of the terms I have read here: CC2540, mini kit, keyfob... So I would appreciate some help with them for clarify i Ideas. I think they are external devices for testing but I don't know the terms and conditions and prices for ordering them.

    Also l have not read yet about the benefits of being member of this TI Community. I think there are free examples or devices. Is this right? how I have to proceed?

    Regarding the Android BCM BLE SDK, where I could download it with the jars and docs. I have noticed since few days that the reference link http://broadcom-ble.googlecode.com is not accesible. Do I have to do some kind of request to Google to be granted to enter inside?

    Other question I have is to know where I could which externals devices are using now BLE and the chipsets used.

    Thanks in advance.

    Best Regards

  • hi,

        Is it possible to discover characteristics using BIG official 16-bit UUID in Galaxy S3, such as BATT_SERVICE_UUID.

        Thanks in advance.

  • Hi,

    I'm trying to test the TimeServer Sample on my Galaxy S3 and my app crash saying that the com.broadcom.bt.le.BleServerService.init is not implemented

    Have you succeed to run this app?

    Do you have some tips for me to run it?

    Thanks in advance,

    Siav

  • Hi Guys

    First thank you rswl88's for sharing your code! This is probably the most workable source I've found so far. With your app and I can read and write parameters, however I am having the same issues, sometime it works, sometime it doesn't. Has anyone managed to get this to work more reliably at all? Also I'm trying to connect to two peripherals at the same time, no luck so far. 

    Any input is very much appreciated.

    Regards

    Reto

  • Hello Reto,

    It is good to hear you have it working.  Now about the reliability, it would appear that this has always been the issue.  You have to be able to pinpoint what just isn't working and when it stops working so that we can come up with a patch for it.  It may be on the CC254x side or the Android side or both.  This is something I have not heard addresses.

    I do not have an Android device to do the testing, but if you can provide more details on when it fails, perhaps I and others could be of more assistance on the CC254x side.  If it completely works successful sometimes, then we should be able to get it working all the time.

    Thanks,

  • I must admit I haven't spent too much time on it yet due to other commitments. I will put some more time into it in the next few days and weeks and report my findings, but if anyone has some newer/more stable code than the one posed by   almost two month ago, please share it.

    Reto

  • Seems there is finally some hope, at least for people using Samsung Galaxy devices with Android 4.2: see http://developer.samsung.com/ble

  • Google just announced official BLE API coming in API 18 later in 2013!

    https://plus.google.com/116110604589325140832/posts/bmqALtLu5oj

  • rswl88, thank you so much for posting the code, it's incredibly helpful.

    It seems to work well on my Verizon Galaxy S3 (SCH-I535), although I cannot read or write from the read/write fragment. I know there is a hex file in the zip file: I tried flashing both and that did not seem to make any difference.

    In my own code, I have successfully connected and paired with the CC2540. All I need to do now is send a 01:00 code to handle 0x0034 to enable the Accelerometer. I believe this is UUID FFA1. How do I do this in the code? Do I have to use the 128 bit UUIDs? Does a flag need to be implemented in the .hex file for 128 bit UUIDs? Is there any way you could post the source code for the .hex files and I could compile it myself?

    I know you must be inundated with requests as you have managed to crack something a lot of us are struggling with! I appreciate any help you can offer.

  • After I updated Nexus-4 with 4.3 manually, I am able to develop BLE application using TI's CC2540DK-MINI .

    Sample BLE scanner project is hosted at google-code .

    Pre built Sample Android BLE Scanner (alpha stages) application can be tried at same site

    In future, I would be adding more code for the TI's KeyFrob demo stuff, GATT discovery and GATT read/write/modify-stuff.

  • Good work! I tried the app. on a Galaxy S4, Pure Android 4.3 today and it works

  • how can you load android OS 4.3 into Galaxy S4?

  • Hi,


        I am not able to make connection between cc2541 module and lenovo tablet A3000-H which has Bluetooth 4.0 and running Android 4.2.2.

    I programed the cc2541 module with keyfob peripheral demo hex file. I press right button (p0_1) to start advertising. As I noticed on other module with TI smart studio the advertising starts. But the tablet just doesn't show my cc2541 module in the bluetooth scanned list.  

     Am I making some very obvious mistake? Any help is appreciated..

    Thanks

  • Yes, you miss the point that Bluetooth 4.0 works only with Android 4.3 and above unless you use 3rd party BLE SDK. I am not sure if Lenovo supplies 3rd party SDK (probably not). Hece, uness you upgrade your device to 4.3, you won't have BLE connections.

    Good Luck!

  • We have released our BLE SensorTag Android App:

    Google Play - TI BLE SensorTag Android App

    LPRF Rocks the World

  • E2E, I need make a correction to my post.

    This is incorrect:

    We have released our BLE SensorTag Android App:

    Google Play - TI BLE SensorTag Android App

    LPRF Rocks the World

    This is not a TI Android App, but developed by the App developer Steven Rudenko

     

    Thank you,

    LPRF Rocks the World

  • Hi all,

    I know its been a while since anyone posted on this forum, but does anyone happen to have working source code for both the CC254x and Android 4.3 sides? 

    I've been working off of the app from Steven Rudenko, but am not able to write data to my Sensortag. I can only read data. Please let me know if someone has gotten this to work.

    Many thanks

  • You can download TI's own SensorTag app (v. 1.10) here (it also contains the complete source): http://processors.wiki.ti.com/index.php/Bluetooth_SensorTag#Android. Version 1.20 will be available on GooglePlay in early February. The app is quite similar to Rudenko's. An alternative is to have a look at Android's own Bluetooth Le example (part of Android SDK).

    The SensorTag firmware is part of TI's official BLE Stack distribution: http://www.ti.com/tool/ble-stack

  • Hi Jomar,

    That is great news about a new version. Is there any chance the new demo app will be better segmented into the demo UI + a library for accessing the SensorTag? I'm currently refactoring the 1.10 demo so I can re-use segments of the code in my own demo app, but if the new version is better modularized, I'll hold off for a bit and wait for that version. Thanks!

  • Apart from the BluetoothLe service there has been no attempt to fully separate GUI and BT for the time being. Creating a SensorTag specific library has been on my mind, but the moment we simply don't have the bandwidth. I could foresee such a library consisting of a Sensor base class, and one class for each individual sensor. I admit it would make life a lot easier for customers if we could hide the GATT details. So for now version 1.20 only offers a few bug fixes and some GUI improvements, but most importantly: it will be published via GooglePlay from now on. 

  • Thanks for the quick response! I'll just keep going with my current plan then.

  • If I may suggest, in MainActivity.java, it should check to see if the device name is NULL, as follows, to prevent a crash when device.getName() returns NULL:

    private boolean checkDeviceFilter(BluetoothDevice device) {
    int n = mDeviceFilter.length;
    if (n > 0) {
    boolean found = false;
    for (int i=0; i<n && !found; i++) {
    String deviceName=device.getName();
    if(deviceName != null) {
    found = deviceName.equals(mDeviceFilter[i]);
    }
    }
    return found;
    } else
    // Allow all devices if the device filter is empty
    return true;
    }

  • This bug is one of those who have been fixed for the upcoming 1.2 version, but thanks for spotting it and letting us know anyway.

  • Lenovo does have a third party BLE implementation.  I have a B6000-F Yoga 8 running 4.2.2 and it will pair with the tag fine. 

    Since all the software for using it is 4.3 and above I can't install any and will have to try and make something custom to do it....darnit.

  • Hi Jomar,

    You mentioned an Android app update coming in early February, but I still see version 1.1 from September of 2013 at this link:

    http://www.ti.com/tool/sensortag-sw

    Is it coming out soon? Hoping to integrate new code that crashes less.

  • Unfortunately we we have got delayed due to some minor issue, but we could arrange to send the code to you.

  • Hi Jomar,

    Thanks for the reply. I was busy with another project the last couple of weeks, but will be returning to this shortly. If your new code isn't going to be available publicly soon, it would be useful for us for creating a more generic SensorTag library for Android.

    On that note, I want to clarify that so long as we (as required in the header of all the source files) keep your header for the portions that use TI code, and that we use your Android app code :

       "solely and exclusively in conjunction with a Texas Instruments Bluetooth device"

    that we would be ok to distribute the code as part of a library for the SensorTag? Or would we have to keep it privately and not release source code for at least those portions of our app? Our app connects to multiple bluetooth devices, but we would make sure that the TI code was only used for talking to the SensorTag. However, if the library turns out well, we may like to release it as open source so others could use it, but building it would obviously be easier with code from the TI demo app. Just want to make sure we don't run afoul of any issues with your code, and that we know what we can actually do with it.

    No chance you can release the demo app code under an MIT or similar license to simplify these kinds of issues?

    Thanks!
    -Jeff

  • Thanks for checking out the license term before releasing your code. The code we release for SensorTag provided to our customers to make it easy to interface to our products.

    The license terms does not allow us to distribute code to interface to no-TI devices. 

    Regards

    Jarle Boe

  • Thanks for the response, but I'm not sure it answers my question. I hope you aren't saying that we can't even use the demo app code for our own project, using it ONLY to connect to the TI SensorTag, if our app (using other code) also connects to other Bluetooth devices like the Pebble. And it also does not tell me whether we'd be ok releasing an open-source library that uses the TI code (still marked with your license header) that only serves to connect to the SensorTag.

    I think it is going to be difficult for more people other than use to quickly use the SensorTag if there isn't a fairly easy library to use it with. I was at a Hackathon here in Montreal and another team tried to use the SensorTag for their project, but failed to get it working since there was no easy-to-use library.

    So in the end, although it will be more difficult, I'm thinking we'll just use the information and (license free) sample code snippets (citing them in our source) on the SensorTag wiki (http://processors.wiki.ti.com/index.php/SensorTag_User_Guide#Gatt_Server), and throw away all the TI demo app code we'd integrated previously, rewriting it from scratch on our own without even looking at the TI demo app code, to avoid any licensing issues.

    It is a bit of a mystery to me why you wouldn't want the SensorTag demo app code to be fully reusable in order to promote the devices. But not my call, so we do what we can...