Connection to Beacon twice instead of once

Hi,

I’m using Estimote SDK 1.4.0.
I’ve migrated my project from 0.16.0.

I’m using ConfigurableDeviceListener.
I’ve followed the steps in the DeviceConnection tutorial.

But every time I connect to a beacon, I see a strange behaviour.

This this my onConnected method.

public void onConnected() { Log.d("XXX", "onConnected"); }

Im logcat I see two messages:

12-07 14:32:31.884 D/XXX: onConnected 12-07 14:32:32.042 D/XXX: onConnected

If I try to read the settings, it happens twice and if I try to write some settings it also happens twice.
But I call

connection.connect(new DeviceConnectionCallback(){.....});

only one time!

What can be wrong?
Am I doing something fundamentally wrong?

Hi @alexander!
Have you checked out the guide for upgrading to SDK 1.0.0 and above?
There’s been a lot of changes between the two versions, so even if it might not directly address your question, it’s still worth a read.
Cheers!

Hi @Raphael
I’ve already read it.

here my code (only the beacon important parts, without BeaconManager and ConfigurableDeviceListener part):

in onCreate of Activity:

    DeviceConnectionProvider connectionProvider = new DeviceConnectionProvider(this);
    connectionProvider.connectToService(new DeviceConnectionProvider.ConnectionProviderCallback() {
     @Override
     public void onConnectedToService() {
        connectedToConnectionProvider =true;
    });

In my activity, I can see a list with all available beacons nearby.
In an ArrayList, I store the found ConfigurableDevices.
On item click, I call this function:

public void connectToBeacon(ConfigurableDevice configurableDevice) {
        
        if (connectedToConnectionProvider) {
            if (configurableDevice != null) {
                
                final DeviceConnection connection = connectionProvider.getConnection(configurableDevice);

                if (!connection.isConnected()) {
                    

                    // Erzeuge eine Verbindung zum Gerät
                    connection.connect(new DeviceConnectionCallback() {

                        @Override
                        public void onConnected() {
                            Log.d("XXX", "onConnected");
                        }

                        @Override
                        public void onDisconnected() {
                            
                        }

                        @Override
                        public void onConnectionFailed(DeviceConnectionException e) {
                            
                        }
                    });
                }
            }
        }
    }

Thanks!
We’ll be trying to recreate this on our end. What’s your device model and system version?

Manufactor/ producer: RugGear
Model: RG730
OS: Android 5.1

update1: I’ve tested it on my own Samsung Galaxy S6 edge (Android 7) and the problem doesn’t occur.

update2: on RugGear RG735 (Android 6) the problem also doesn’t occur. It seems to be an Android 5 problem.

We’ve checked this on our in-house Nexus 5, running Android 5 (we don’t have a RugGear on hand), but the connection worked OK for us. Maybe it’s something specific to the RG730?

I’ve tried to connect to a beacon via Estimote App, but only some value are being read, the other not.

The progress bars are spinning and spinning, until I interrupt the process by clicking return-key.

BUT: for a while ago, it was possible to connect without problems via Estimote App and on RG730.