Board doesn't disconnect

Hello,

I'm developing an app and in the onDestroy section I use the tearDown and disconnectAsync methods, but when I rerun the scanner, the board doesn't appear in the list, until i disconnect the bluetooth of my mobile phone.

I've tried with the metawear app, and the problem shows up too.

Is a problem with my mobile phone?
Thanks for the help.

Comments

  • Is the onDestroy method getting called?
  • Yes. In both apps.

    Sorry for the delay with my answer, I had to stop my development two months.
  • It looks like the board doesn't actually disconnect in the onDestroy function.  You can try to reverse the app flow and only leave the activity once the board has disconnected.
  • I've tried to update the firmware, but it failed. After that, i wasn't able to connect to the board, so I've removed the battery, and put it on again pressing the button to start the board in metaboot mode. Then I used the metawear app with an Iphone, to reconnect to the board, and finally I could connect it again. After all that, I don't have more problems with the disconnections.

    Why the android app doesn't work for reseting a board from the metaboot mode like Iphone's app?
  • It worked for two hours, now I'm having the same problem again, with my app and with metawear app. It doen's disconnect when I close the apps.
  • edited July 22
    The MetaWear app needs to be updated to use the latest Android SDK, which addressed a bug with connecting to boards in the MetaBoot state.

    Change your app flow as I suggested in my previous post and make sure your device cleanly disconnects before closing the app.  The android devices in the office have no issue with force closing apps.  When such an event occurs, the log shows the GattService disconnecting from the device

    07-21 19:57:43.987 2906-13415/? D/BtGatt.GattService: Binder is dead - unregistering client (5)!
    07-21 19:57:43.987 862-2217/? I/WindowState: WIN DEATH: Window{8700ee5 u0 com.mbientlab.metawear.tutorial.starter/com.mbientlab.metawear.tutorial.starter.DeviceSetupActivity}
    07-21 19:57:43.987 862-4475/? D/GraphicsStats: Buffer count: 8
    07-21 19:57:43.988 2906-2927/? D/BtGatt.AdvertiseManager: message : 1
    07-21 19:57:43.988 2906-2927/? D/BtGatt.AdvertiseManager: stop advertise for client 5
    07-21 19:57:43.990 2906-2927/? D/BtGatt.AdvertiseManager: app died - unregistering client : 5
    07-21 19:57:43.990 2906-2925/? E/bt_btif: btgattc_handle_event invalid instance ID in BTIF_GATTC_DISABLE_ADV
    07-21 19:57:43.991 2906-2927/? D/BtGatt.GattService: unregisterClient() - clientIf=5
    07-21 19:57:43.991 2906-2934/? W/bt_btif: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016
    07-21 19:57:43.991 2906-2934/? W/bt_btif: bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0016
    07-21 19:57:43.991 2906-2934/? W/bt_btif: bta_gattc_conn_cback() - cif=5 connected=0 conn_id=5 reason=0x0016
    07-21 19:57:43.993 862-872/? I/WindowState: WIN DEATH: Window{53f206f u0 com.mbientlab.metawear.tutorial.starter/com.mbientlab.metawear.tutorial.starter.MainActivity}
    07-21 19:57:44.008 862-2216/? D/ActivityManager: cleanUpApplicationRecord -- 8635
    07-21 19:57:44.013 862-873/? D/ActivityManager: cleanUpApplicationRecord -- 3166
    07-21 19:57:44.016 2906-2925/? D/BtGatt.GattService: onDisconnected() - clientIf=5, connId=5, address=D4:5E:82:E1:15:01
    07-21 19:57:44.016 2906-2925/? E/BtGatt.ContextMap: Context not found for ID 5
    07-21 19:57:44.018 2906-2934/? I/bt_btm_sec: btm_sec_disconnected clearing pending flag handle:64 reason:22
    07-21 19:57:44.020 2906-2925/? E/BluetoothRemoteDevices: state12newState1
    07-21 19:57:44.023 2906-2906/? D/BluetoothMapService: onReceive
    07-21 19:57:44.023 2906-2906/? D/BluetoothMapService: onReceive: android.bluetooth.device.action.ACL_DISCONNECTED
    07-21 19:57:44.026 30419-30419/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth disconnect broadast for MetaWear D4:5E:82:E1:15:01
  • I'll try your suggestion. I've tried with an iphone, and the disconnection works fine, so the problem is not with the app/board, it seems that the problem is my Android phone.

    Thanks for everything.
Sign In or Register to comment.