onConnectionStateChange status (19)

Hi! I 'm getting this error when i try to connect with Android to my MetMotionR sensors:
Error - >java.lang.IllegalStateException: Non-zero onConnectionStateChange status (19)

I have a lifecycle aware component that implements ServiceConnection and observed by my fragment. I think that this error has
something to do with how i handle sensor disconnection. On my OnDestroy method i do:

@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
fun onDestroy() {
    stopLed()
        board.tearDown()
        board.disconnectAsync()
        context.unbindService(this)
    }

Comments

  • Does a connection eventually succeed if you retry?

  • Yep, the problem seems to be fixed with a retry function. I also noticed that if you wait disconnectAsync to complete
    (board.disconnectAsync().waitForCompletion()) you will not get Non-zero onConnectionStateChange status (19). But that's a bad practice because you wait an async call in onDestroy.

Sign In or Register to comment.