Asaf Manassen
Asaf Manassen

Reputation: 4203

Is there a way to auto connect Sphero in android

I want my app to connect all paired Sphero automatically. I saw there is a class called orbotix.robot.internal.AutoReconnectCommand; but I cannot find any javadoc for this class. Is there a way to auto connect Sphero in android without showing the connection screen?

Upvotes: 0

Views: 204

Answers (1)

Asaf Manassen
Asaf Manassen

Reputation: 4203

I found an answer for my own question
You can use :

porvider.addConnectionListener(mConnectionListener);
porvider.addDiscoveryListener(mDiscoveryListener);

For connecting Sphero without using the given GUI from orbotix in the mDiscoverListener you will need to implement a method call onFound.
In case you have only one robot you can implement it in the following way

@Override
        public void onFound(List<Sphero> paramList)
        {
            Sphero s=paramList.get(0);
            RobotProvider.getDefaultProvider().connect(s);
        }

If you have more than one robot you can add GUI by yourself for choosing a Sphero

Upvotes: 2

Related Questions