[ANDROID] Multiple calls to Mds.connect()

Issue #69 on hold
Philipp Hafner created an issue


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)

Comments (4)

  1. Philipp Hafner reporter

    Using something like this:

    if( !doneOnce )
                doneOnce = true;
                mMds.connect(mac, null);

    still causes the onDisconnect callback to fire, although onConnectionComplete is not called anymore, when connecting more than once.

  2. Klaus Förger

    I can confirm this bug. It also seem to affect the onConnect method which is also called multiple times when reconnecting.

    The same thing happens also when I connect 5 sensors. On the first connection onDisconnect and onConnect are called 5 times per sensor which means a total of 25 times. On the second connection, the methods are called 10 times per sensor, total of 50 times. Thus we get a huge amount of spam from those methods after a few reconnections.

    I used mobile lib version 1.28.1 and firmware version 1.7.2.

  3. Log in to comment