I think I have found a bug in the MDS library.
I have attached a small sample application (with source) to demonstrate the problem.
I connect to my device using the following code:
This works as expected, disconnecting is done by simply calling:
However, after connecting again, disconnecting causes the onDisconnect callback to be called twice. Doing this again, causes it do get called three times. onConnectionComplete is always called only once. I am suspecting that the underlying callback/subscription is not deleted correctly. It seems this causes all kinds of problems when connecting/disconnecting to multiple devices frequently.
When looking at my minimal error sample, you would want to take a look to the MoveSenseManager class.
For your convenience, I uploaded a log here which demonstrates the problem.
Hardware: G variant: MDS Library: 1.13.0 (march 18) Android 7 (Asus tablet)