Bluettoth connection

Metawear board doesn't connect with my custom app for first time, however once connect board with metawear app and then disconnect and reconnect with my app, it connects instantly. I have implemented the same module and code which is there in metawear sample.
   - Tested with many Android phones and versions
   - updated firmware version
   - check permissions (android.permission.BLUETOOTH_ADMIN" , android.permission.BLUETOOTH" )

Please guide me what is there that i am missing or should be done to establish reliable connection like metawear app.

Comments

    • What is the error that is returned by the connect task?
    • Does the app successfully connect the 2nd time?  3rd time? etc.
  • edited September 2017
    The error:
    Error connectingjava.util.concurrent.TimeoutException: Board connection timed out
     
                                                                         at

    com.mbientlab.metawear.MetaWearBleService$GattConnectionState$1.run(MetaWearBleService.java:239)
                                                                           at android.os.Handler.handleCallback(Handler.java:751)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                           at android.os.Looper.loop(Looper.java:154)
     
                                                                         at
    android.app.ActivityThread.main(ActivityThread.java:6334)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
     
                                                                         at

    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
     
                                                                         at
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

    I have implemented a loop so that if connection fails at first time, it try to connect until connection is successful. but sometimes board doesn't connect even after several tries and after long time. but can be connected with metawear app.

    I have not implemented scanner module in my app, which I think is implemented in metawear app. Is that can be possible issue?


  • Try connecting to the board using the starter app:

    If that app still fails to ever connect to a board, try restarting the BT adapter when said connection error occurs.
This discussion has been closed.