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 4.3 App support for SensorTag Released

Other Parts Discussed in Thread: CC2541, CC2540

Anyone having any luck with the new Android App?

I am trying it on a Nexus 4. I can see the SensorTag but when I try to view data the app  crashes... (very)early days yet ;)

Dale

  • Hi, I've just compiled and tested version 1.0 on my nexus 4. It goes much much better than 0.93 :)

    Still has connection problems but I've managed to make it work in a stable way following these steps:

    -Turn off bluetooth

    -Open the app, a messages about turning on BT is shoun. Accept

    -The sensor is shown with a connect button, tap it.

    -The service selector is shown, select at most four of them.

    -NEVER SELECT HIGROMETER: if this one is selected no service will work and the connection will be continuosly lost.

    -Press connect at the bottom of the list and enjoy.

    So remainig issues are:

    -With Bt before running app I've never get it to work

    -Hygrometer has issues.

    -In the code there is an option for firmware upgrade that is not reachable at running time

    Thanks fro the great work!

  • Hi Miguel,

    The Humidity sensor and old FW versions doesn't play well with Android due to the low 7.5 ms connection interval. We recommend you upgrade the firmware to version 1.4, found here:http://processors.wiki.ti.com/index.php/SensorTag_Firmware

    FW upgrade OAD will be added in version 1.1. This version will also do away with the the Java netbeans library (PropertyChangeListener) to obtain a code structure that is similar to Android's own BLE sample application.

  • "not pay well" is an understatement

    We could not get any connection working with that code. Debugging the kernel leads to this; the Link Control Block is missing, probably due an assertion error or something. Anybody got anything beyond scanning to work with 4.3.1???

    This logcat is from connected successfully to the message: unknown address, which means that the LCB is missing, when you look at the source: 

    09-04 19:33:50.757: D/bt-att(951): GATT ATT protocol channel with BDA: 73884ca1bd76 is connected
    09-04 19:33:50.757: D/bt-att(951): gatt_is_bda_in_the_srv_chg_clt_list :73-88-4c-a1-bd-76
    09-04 19:33:50.757: D/bt-btm(951): btm_sec_is_a_bonded_dev is_bonded=0
    09-04 19:33:50.757: D/bt-att(951): connected is TRUE reason=1
    09-04 19:33:50.757: D/bt-att(951): gatt_get_ch_state: ch_state=2
    09-04 19:33:50.757: D/bt-att(951): gatt_set_ch_state: old=2 new=4
    09-04 19:33:50.757: I/bt-att(951): gatt_profile_connect_cback: from 73884ca1bd76 connected:1 conn_id=1 reason = 0x0000
    09-04 19:33:50.757: D/bt-btif(951): bta_gattc_conn_cback: cif = 3 connected = 1 conn_id = 3 reaosn = 0x0000
    09-04 19:33:50.757: D/bt-btif(951): bta_gattc_conn_cback: cif = 4 connected = 1 conn_id = 4 reaosn = 0x0000
    09-04 19:33:50.757: D/bt-att(951): gatt_num_apps_hold_link num=1
    09-04 19:33:50.757: I/bt-att(951): GATT_SetIdleTimeout idle_tout=65535 status=1(1-OK 0-not performed)
    09-04 19:33:50.757: I/bt-smp(951): SMDBG l2c smp_connect_cback
    09-04 19:33:50.757: D/bt-btm(951): btm_ble_update_mode_operation adv_mode = 0
    09-04 19:33:50.757: I/bt-btif(951): BTA got event 0x108
    09-04 19:33:50.757: I/bt-btif(951): bta_dm_sm_execute event:0x8
    09-04 19:33:50.757: D/bt-btm(951): btm_bda_to_acl found
    09-04 19:33:50.757: D/bt-btm(951): BTM_ReadRemoteFeatures
    09-04 19:33:50.757: W/bt-btif(951): info:x0
    09-04 19:33:50.757: I/bt-l2cap(951): L2CA_SetDesireRole() new:x1, disallow_switch:0
    09-04 19:33:50.757: I/bt-btif(951): BTA got event 0x108
    09-04 19:33:50.757: I/bt-btif(951): bta_dm_sm_execute event:0x8
    09-04 19:33:50.757: I/bt-btif(951): BTA got event 0x1f0c
    09-04 19:33:50.757: D/bt-btif(951): bta_gattc_conn server cache state=0
    09-04 19:33:50.757: D/bt-btif(951): bta_gattc_conn conn_id=4
    09-04 19:33:50.757: I/bt-att(951): GATT_GetConnectionInfor conn_id=4
    09-04 19:33:50.757: I/bt-l2cap(951): L2CA_EnableUpdateBleConnParams - BD_ADDR 73884ca1bd76 enable 0 current upd state 0
    09-04 19:33:50.757: D/bt-btif(951): bta_gattc_cache_open conn_id=4
    09-04 19:33:50.757: I/bt-btif(951): BTA got event 0x1f12
    09-04 19:33:50.757: D/bt-btif(951): bta_gattc_ci_open conn_id=4 server state=1
    09-04 19:33:50.757: I/bt-btif(951): BTA got event 0x1f13
    09-04 19:33:50.757: D/bt-btif(951): bta_gattc_ci_load conn_id=4 load status=138
    09-04 19:33:50.757: D/bt-btif(951): bta_gattc_start_discover conn_id=4 p_clcb->p_srcb->state = 3
    09-04 19:33:50.757: I/bt-l2cap(951): L2CA_EnableUpdateBleConnParams - BD_ADDR 73884ca1bd76 enable 0 current upd state 1
    09-04 19:33:50.757: I/bt-btm(951): BTM_InqDbRead: bd addr [73884ca1bd76]
    09-04 19:33:50.757: D/bt-btm(951): btm_find_dev_type - device_type = 2 addr_type = 1
    09-04 19:33:50.757: I/bt-att(951): GATTC_Discover conn_id=4 disc_type=1
    09-04 19:33:50.757: I/bt-l2cap(951): L2CA_SendFixedChnlData() CID: 0x0004 BDA: 73884ca1bd76
    09-04 19:33:50.757: D/bt-l2cap(951): TotalWin=13,Hndl=0x40,Quota=8,Unack=1,RRQuota=0,RRUnack=0
    09-04 19:33:50.757: I/bt-btif(951): btif_dm_upstreams_cback ev: BTA_DM_LINK_UP_EVT
    09-04 19:33:50.757: D/bt-btif(951): BTA_DM_LINK_UP_EVT. Sending BT_ACL_STATE_CONNECTED
    09-04 19:33:50.757: D/bt-btm(951): btm_bda_to_acl found
    09-04 19:33:50.757: D/bt-btm(951): BTM_ReadRemoteVersion
    09-04 19:33:50.757: D/(951): remote version info [73:88:4c:a1:bd:76]: 0, 0, 0
    09-04 19:33:50.757: D/bt-btif(951): in, bd addr:73:88:4c:a1:bd:76, prop type:12, len:12
    09-04 19:33:50.757: D/bt-btif(951): post cmd type:1, size:0, h:7,
    09-04 19:33:50.757: I/bt-btif(951): HAL bt_hal_cbacks->acl_state_changed_cb
    09-04 19:33:50.765: D/bt-btif(951): cmd.id:4
    09-04 19:33:50.765: D/btif_config_util(951): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
    09-04 19:33:50.765: E/BluetoothRemoteDevices(951): aclStateChangeCallback: Device is NULL
    09-04 19:33:50.765: D/bt-btif(951): HC lib lpm deassertion return 0
    09-04 19:33:50.765: D/bt-btif(951): HC lib lpm deassertion return 0
    09-04 19:33:50.765: I/bt-btif(951): btif_dm_upstreams_cback ev: BTA_DM_BUSY_LEVEL_EVT
    09-04 19:33:50.765: D/BtGatt.btif(951): btif_gattc_upstreams_evt: Event 2
    09-04 19:33:50.772: D/bt-btif(951): found node is NULL
    09-04 19:33:50.772: I/bt-btif(951): HAL bt_gatt_callbacks->client->open_cb
    09-04 19:33:50.772: D/BtGatt.GattService(951): onConnected() - clientIf=4, connId=4, address=73:88:4C:A1:BD:76
    09-04 19:33:50.772: D/BluetoothGatt(2360): onClientConnectionState() - status=0 clientIf=4 device=73:88:4C:A1:BD:76
    09-04 19:33:50.772: D/BluetoothLeService(2360): onConnectionStateChange (73:88:4C:A1:BD:76) 2 status: 0
    09-04 19:33:50.788: I/MainActivity(2360): onGattConnect
    09-04 19:33:50.788: I/ActivityManager(389): START u0 {cmp=ti.android.ble.devicemonitor/.DeviceActivity} from pid 2360
    09-04 19:33:50.804: I/bt-hci(951): BLE HCI(id=62) event = 0x04)
    09-04 19:33:50.804: I/bt-btm(951): btm_ble_read_remote_features_complete
    09-04 19:33:50.804: D/bt-btif(951): HC lib lpm deassertion return 0
    09-04 19:33:50.804: D/bt-l2cap(951): l2cu_release_ccb: cid 0x0004 in_use: 1
    09-04 19:33:50.804: D/bt-att(951): GATT ATT protocol channel with BDA: 73884ca1bd76 is disconnected
    09-04 19:33:50.804: D/bt-att(951): gatt_is_bda_in_the_srv_chg_clt_list :73-88-4c-a1-bd-76
    09-04 19:33:50.804: D/bt-btm(951): btm_sec_is_a_bonded_dev is_bonded=0
    09-04 19:33:50.804: D/bt-att(951): gatt_cleanup_upon_disc
    09-04 19:33:50.804: D/bt-att(951): found p_tcb
    09-04 19:33:50.804: D/bt-att(951): found p_clcb conn_id=4 clcb_idx=0
    09-04 19:33:50.804: D/bt-att(951): gatt_end_operation status=133 op=1 subtype=1
    09-04 19:33:50.811: D/bt-btif(951): bta_gattc_disc_cmpl conn_id=4
    09-04 19:33:50.811: W/bt-l2cap(951): L2CA_EnableUpdateBleConnParams - unknown BD_ADDR 73884ca1bd76

  • Hi Juergen,

    1. What version of the SensorTag code are you working with? The latest is 1.0 which was published yesterday. The source is also available in the same installer.

    2. What Android device are you running on?

    3. You mention Android 4.3.1. Is this a typo or are you working from AOSP? 

  • Hi Jomar: 

    I just downloaded the latest code (1.0.0 released on Sept .3, 2013) on a Nexus 7 2013 (with Android 4.3), compile it in ADK/Eclipse, but the apk behaved the same as the 0.9.3 version on the same device.  Basically, after initial recognition of the SensorTag, the 'Connect' button became grayed-out.  I did what Miguel described, but still got 'Connect' button grayed-out in one second.

    1). Is the latest Android code explicitly tested on a Nexus 7 2013?  

    2). Any suggestions?

    Thanks.

  • The method for determining if a device deliver one or multiple scan results per scan is per today quite crude. We just check the build number. See LeController.java, function getScanType(). So if the build number of your  OS is different from 'JSS14J' this will fail. Please check in the Settings->About on your tablet if this is indeed your build number.

  • Thanks for your questions, but my question was if anyone has actually ever made a correct BLE connection with receiving services and char reads/write with that Android version?

    ad 1: used several versions, just not getting a connection, always gatt error 133, iPhone works just fine
    Not even the "BLE Device Monitor" can see services. Gatt error 133. See btstack log above.

    ad 2: Nexus Galaxy, BLE enabled, https://developers.google.com/android/nexus/images#takjujwr66y

    ad 3: version 4.3 build JWR66Y, 2 OTA updates since released. Still says 4.3, sorry.

  • We not tested on the Galaxy Nexus so this kind of feedback is extremely valuable. Error number 133 (not defined in the Android BLE stack) has cropped up when we move a device out of range, and then reconnect. The only way to get going again then is to reset the BT adapter. This assumed bug has been reported to Google but we have not had any feedback so far.,

    Btw: Have you tried the Android Sample app? You could also download and try the BLE Accelerator from Bluetooth SIG.

  • Is this thread alive? I'm having the same issue.

    I receivend my SensorTag today, worked like 5 minutes, then I tried like 6 hours to start again. The very first time the app and the SensorTag worked great, but after some minutes, I try to get other sensors and that's the end of the data. My SensorTag is parsed to my nexus but I can't get the data from the sensors. Appears like connected to my device but in the app, in the info screen, just appears an asterisc (*) instead of numbers.

    I tryed reinstalling the app, reseting my phone, moving the battery form the Sensor, pressing 5 seconds the button, but nothing seem work.

    Cellphone: LG Nexus 4
    Android: 4.3
    Compilation: JWR66Y
    SensorTag: Revision 1.4.0
    SensorTag HW: 1.3
    SensorTag FW: 1.4
    SensorTag App: 1.10 

    There is a solution yet? Or I have something that doesn't work properly?
    Any solutions? What can I do?

  • There have been BLE stability issues on Nexus 4. Some user's have reported that turning WiFi off improves stability, and that to get a "clean start", turn Bluetooth off and the on again. Have you tried the BLE Sample application supplied with Android SDK?

  • Hi...
    I have not tried the samples from Android SDK, I gonna do that... Later I gave you my feedback.
    For WiFi and turning on and off BT on my phone I do that (I read it  on the blog) but, didn't work!

    Im right if I think that you are working hard for a better performance of this product? Because so far I read that on Apple devices is not many problems right?

    Last question, this errors are just on Nexus 4 or Android issues?

    Thanks! 

  • I tried all sorts of combination of sensors, user behaviour etc. on the Nexus 4, and just can't get it to fail. It is therefore important that you try Android's sample app as well, to help isolate the issue (even that app works on my phone).

  • Thanks! that solves the "greyed out connect button" on Nexus 7 2013

    indeed, in LeController line 175, after changing the model to JSS15R it now works.

    if (Build.MODEL.equals("Nexus 7") && Build.DISPLAY.equals("JSS15R"))

  • I apologize if this has been answered already, at a cursory look through all the posts I haven't found an answer.

    I just noticed on the Bluetooth SensorTag wiki page that Nexus 7 (2012) (JWR66V) is supported. I installed the app on mine and it says "BLE not supported on this device". I checked the build number on my Nexus and it is JWR66Y not JWR66V. Is there anything I can do (besides wait for an app update) to enable BLE support on my tablet?

    Thanks in advance for all the help!

  • Has the Nexus OS been upgraded Android version 4.3 ?

  • DaleGomes said:

    Has the Nexus OS been upgraded Android version 4.3 ?

    Yes, sorry I forgot to mention it, I have 4.3 installed.
  • My Nexus is at home right now so I cant test, but from memory I vaguely remember there being problems with the Nexus 7.

  • It would be awesome if there is anything I could change to make this work or if a future Android app update would address this, it is the only BLE enabled device I have at this time (well, I hope it is enabled, until I saw the wiki today I was sure it is not but the wiki gave me hope). Thanks for your help!

  • For the 2012 version of the nexus 7 there an app that should enable BTLE (installing 4.3 is not enough as you have noticed)  https://play.google.com/store/apps/details?id=com.manuelnaranjo.btle.installer2

    It does cost 7.5, but it might save you 10 on asperins trying to fix it yourself ;-)  I have not tried this app because I have a 2013 model.

    Further you could face the "greyed out connect button" issue:

    The code is written such that for the Nexus 7 it expects 1 advertising device per scan-request. This is done by selecting CONTINUOUS mode. For the code this means that a separate thread will be started which will issue a scan request each 300 msec. However if the model is JSS15J than the mode is set to ONE_OFF (appearently from a modelversion JSS15J  the Nexus can give multiple results per scan request)

    This looks a hack to me, as it should enable the ONE_OFF mode when the version is NEWER than JSS15J.

    My Nexus has version JSS15R, so I changed the precondition to checking for  JSS15R...iso JSS15J, still  a hack although but it works.

    Here a snipped of the relevant code in LeController.java

    ScanType scanType = ScanType.CONTINUOUS;

    if (Build.MODEL.equals("Nexus 4"))
               scanType = ScanType.ONE_OFF;

    // Nexus 7 (2013)
    if (Build.MODEL.equals("Nexus 7") && Build.DISPLAY.equals("JSS15J"))    
           scanType = ScanType.ONE_OFF;

  • Thank you so much Rick for all this info, you are great!

  • In the explanation about the CONTINUOUS- and ONE_OFF-scanmode I didn't describe it correctly. This does however not influence the solution.

    CONTINUOUS means that the android device handles more than 1 advertisement per call, whereas ONE-OFF does expect only 1. Hence the thread that periodically calls bluetoothAdapter.startLeScan() is started only in ONE-OFF mode (nexus 7 2013).  So the situation is actually opposite as described in my previous post, and I think that the modification is not needed for the 2012 model. Anyway if the connect button is greyed out  you know what to do.... 

  • Hey Amrish, how are you doing today?

    Happy to see that you have successfully start receiving temp update on your Android, I am using a pedometer to do the same thing, I'll be very glad you could share the code (if it's okay to you of course), so that I may also solve my problem.
    Thank you 

  • if you download this http://www.ti.com/tool/sensortag-sw and see the source code.

    it will help you more than my written code.

    Regards

    Amrish K. Tewar

  • Checked the downloads, it has nothing but SensorTagAndroidApp-1.1.0-windows-installer.exe inside a zip file. I installed it, but it doesn't have neither the code nor the .apk.
    Please tell. 

  • when you download the exe

    pl. find C:\Applications\SensorTag Android App\SourceCode

    Amrish K. TEwar

  • Hello Markus,

    I meet same as issue humidity service ,do you found root cause?

    Thanks

    Ben

  • In SensorTag FW versions prior to 1.4, accessing the humidity service caused a disconnect from Android devices. Please upgrade your SensorTag FW (this can be done via the OAD featiure in the app)

  • Hello Ben,

    When I try to upgrade the FW the app says that "OAD upgrade is not available on this device"

    Is there any chance of upgrading the firmware of my device? 

     

  • There are two other ways:

    1. Use the CC Debugger from TI with the SmartRF Flash Programmer

    2. Use BLE Device Monitor and OAD  http://processors.wiki.ti.com/index.php/BLE_Device_Monitor_User_Guide

  • Hi I have a galaxy S4 with Android 4.3, I can connect to SensorTag(s) with demo app but I getting 3-4 sensor data is a big problem. Everytime, I cannot get data from one of the sensors, randomly. I have to turn on/off the preferences like 10 times. I think sensortags don't get one of the service enable messages. Does anyone have the same problem with me?

    My second question is : how can I see the firmware version of tags? 

  • Hi,

    Sorry for the late answer. You can download the BLE Device Monitor from Google Play. This app will display all the available services and characteristics and you can also use it to upgrade the FW on the SensorTag.

    Please note that OAD does not work properly on Samsung Galaxy S3, i.e. Samsung devices running Android 4.3.

    Best regards,

    delete

  • Dear TI,

    May I ask what BLE 1.4 version not import OAD? because I use my android phone cannot use OAD upgrade

    I want to upgrade via android phone.

    Miss step?

     

    Thanks

    Ben

  • BLE 1.4 supports OAD and this is implemented in SensorTag. That said, there are some specific challenges with Android:

    1. You need to have SensorTag firmware Rev. 1.4 or 1.5 for it to work. You can check the revision in the Device Information service. If your firmware revision is 1,3 or lower, please upgrade either by using the Windows BLE Device Monitor or iOs.

    2. OAD doesn't work with some Android 4.3 devices. Unfortunately Galaxy S3 is one of them

  • Hi Jomar,

    I have a BLELight sample from TI with CC2540 on board. I am using sensortag app on Samsung Galaxy S4 with android 4.4.2. I was told by a TI rep that i can change the RGB colors on this board using the app. Please confirm if this is true. Thanks.

  • Keyur, sorry to bother you... what is a BLELight? I searched the TI website and also the web and came up empty. Do you have a link for this board? It sounds very interesting. Thank you!

  • Claudiu,Its not out on the TI website yet thats why i need help. BLE light is basically this http://processors.wiki.ti.com/index.php/ZStack-Lighting_Kit but the bluetooth low energy version. It may be coming out soon.

  • That looks great, thanks for sharing.

  • Hi Keyur, 

    Currently that demo board is only supported by the iOS version of the app I'm afraid. 
    There is no publicly available information to if or when we will officially release this as a kit. 

    Regards, 
    Kjetil

  • Hi Kjetil,

    If you have an internal android demo app that works with it can you share the apk?

    Thanks,

    Keyur

  • Hi,

     

    could I ask again why there is no Android apk located on

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

    only IOS ...

    Could someone point me to the latest ti sensortag apk? I am running Android 4.4.2. on a custom platform.

     

    Thanks,

    --Gunter

  • Dear Sir, 

    DaveSmith is very good. His code is very clear. I learn a lot from his video clip on Youtube. 

    But I have question about how to transfer Rssi into distance. The formula on internet is not very suitable for SensorTag.

    Is there any formula which can precisely transfer Rssi on to distance(cm) ? 

    Appreciate a lot if any pro can give me answer. 

    Best Regards, 

    Roger Ma 

  • Hello,

    where can I download the Android app project from TI?

    Thank you.

  • Hi,

    thank you for your answer.

    I am not used with android development. This is actually first time I am programming.

    Is there any way to only download the project? I am not used with GITORIOUS and those file managers.

    Is there any way I can just download the project file?

  • Hi Sergio,
    This is the only way we distribute the Android source code. You should definitively learn GIT, if you intent to develop software :)

    Best Regards
    Joakim
  • I am not, this is the first android project I am involved and I am not intent to keep up on it.
  • I know that GIT is very important, but I will use it only this time.