[BUG] Reconnect doesn't work

Hi all,
I've had some problem figuring out what was going on my android app than i discovered the same problem on MetaWear example app too:

When I start the application and connect to the board, everything work as expected.

If I switch off the board, the app correctly disconnect but after a while (about 15 sec.) the app reconnect again even if the board is switched off!! 8|

firmware v0.6.0
Android example app v2.3
Metaware api v1.1


  • How are you switching off the board?  What you are describing sounds like you are only resetting the board, not turning it off.
  • Hi Eric,

    I mean turning it off (no power), unplug usb cable.

    Try to connect to the board using your app, then unplug usb cable from the board, the app correctly show 'connect' label, wait for 15/20 sec and the app show 'disconnect' again even if the board has no usb cable attached.
  • Anyone is experiencing this behaviour?
  • Hi Eric,

    I experienced the same issue even on out of range signal. Your app reconnect to a missing board resulting on a false positive. Please fix!
  • I cannot reproduce this on my Nexus 7 tablet (Android 4.3).  When i unplug my board from the usb cable, the app tries to connect again but nothing happens until I plug the board back in.  All the reconnect code does is call "connect" function from the disconnect callback function.
  • Hi Eric,

    I've tested it on my Motorola MotoG (android 4.4). Please let me know if you get chance to test it on android >= 4.4.


  • This is becoming a limiting issue.

    I bought 4 boards so far and this bug is preventing me to release the final product.

    I can't figure out how this behaviour is affecting all my boards and nobody else is experiencing this.

    These are the detailed steps to reproduce the bug:

    (Step 1) Open Metawear example android app

    (Step 2) Connect to the board
    At this point label change from 'connect' to 'disconnect'.
    This mean the app is connected to the board. Try to switch on the led or run motor to test.

    (Step 3) Take away the board from connection range or unplug usb and disconnect the battery to simulate out of range connection.
    At this point, after few seconds, the label change from 'disconnect' to 'connect'.
    This mean the app lost connection to the board.

    Now comes the problem:
    waiting 20/30 seconds more, the app suddenly reconnect again (label change from 'connect' to 'disconnect') to a lifeless board (no power/out of range). Any action you do (switch on the led or run motor for example) is useless cause the board is not really connected, resulting in a false positive.

    Tested on:

    Firmware v0.8.6
    Android example app v2.3
    Metaware api v1.2

    Please help me to find out a solution.

    Thank you.

  • Hi Biospank,

    I just tested this using a board without battery and it did not exhibit any problems with the connect/disconnect on Android 4.4.3. Did you make any modifications to the sample app?

  • Hi Guarnieri,

    I used the example app (compiled the apk without modification) and the app from google app store as well.

    Same result: after about 30 seconds from disconnection, the app reconnect to an non-existent (no power) board.

    I've debugged the code but I cannot go further cause it's an api level call to reconnect into:

    onServiceConnected.disconnected callback

    Thanks for your help.


  • Some more info:

    Using the nRF MASTER CONTROL PANEL app from Nordic, works as expected.

  • Can you try using a different Android device by any chance? I've tried to reproduce the bug with 3 different devices and haven't had any luck.
  • I've tried with Samsung NEO (Android 4.4.2), Samsung Galaxy S4 (Android 4.4.2) and Motorola Moto G (Android 4.4.4) and get same result.
  • edited December 2014
    I would suggest that you try with only 1 board in the vicinity. If still fails, then maybe you can upload a video of the failure. I will try again with the Galaxy s4 on 4.4.3 just in case.

    Edit: I was able to reproduce the problem at least a few times. However, it required me to trigger something first, such as the LED module before I disconnected the board. We will look into it.

  • Hi Guarnieri,

    I've uploaded a video to show you the behaviour:

    Thanks for your help

  • We are going to add some error checking in the connection code to fix/mitigate this issue.

    Look for an Android API/sample app update.

  • Hi,

    any news/progress on this?

  • edited December 2014
    It's WIP and a fix will be released soon.
  • Hi all,

    I've upgraded my app using the new 1.3.7 api released few days ago and the false positive reconnection seems to be fixed. However, reconnection to a lost bounded device works only within 25 sec. after that you have to reconnect manually.

    Is there any timeout to set to extend the reconnection time?

  • No, the functionality of the reconnect method hasn't changed; all that has happened is its moved to a more appropriate class.  If you want to continually try to reconnect, then you can register a callback for receivedGattError and make a reconnect call there.
This discussion has been closed.