[Java/Android] Failing to connect two Bitalinos to one Android device

Python, Java, Android OS, etc.
kuznip
Posts: 5
Joined: Thu Jan 28, 2016 1:54 pm

[Java/Android] Failing to connect two Bitalinos to one Android device

Postby kuznip » Mon Feb 27, 2017 9:04 pm

Hi,

Does anyone has met this issue: we currently making an app for Android, which supposed to get data from TWO Bitalino devices - via Bluetooth. However, it doesn't work. Does anyone had the same issue? If so, what is the solution?

Best, Illia.

BITalino
Site Admin
Posts: 567
Joined: Tue Aug 27, 2013 3:47 pm

Re: [Java/Android] Failing to connect two Bitalinos to one Android device

Postby BITalino » Tue Feb 28, 2017 12:48 am

Hi Illia,

Can you confirm if you're using the following API:
https://github.com/BITalinoWorld/revolution-android-api

Best regards,
The BITalino Team

kuznip
Posts: 5
Joined: Thu Jan 28, 2016 1:54 pm

Re: [Java/Android] Failing to connect two Bitalinos to one Android device

Postby kuznip » Fri Mar 03, 2017 8:02 pm

We used the API from example:

https://github.com/BITalinoWorld/android-example

We'll try the one you recommended and let know about results.

kuznip
Posts: 5
Joined: Thu Jan 28, 2016 1:54 pm

Re: [Java/Android] Failing to connect two Bitalinos to one Android device

Postby kuznip » Mon Mar 06, 2017 5:39 am

So, we tried to connect with the API you've recommended (https://github.com/BITalinoWorld/revolution-android-api), but it still fails to connect several devices. Any suggestions?

GTelo
Posts: 4
Joined: Mon Mar 06, 2017 10:29 am

Re: [Java/Android] Failing to connect two Bitalinos to one Android device

Postby GTelo » Mon Mar 06, 2017 11:46 am

Hi Illia,

I've added an example to the sample app available at the repository (https://github.com/BITalinoWorld/revolution-android-api) to make it easier for you to understand how to connect and start acquisition with several devices at the same time.

In order to use the example you will need to uncomment the following lines of code, in the DeviceActivity class:

Code: Select all

//    private BITalinoCommunication bitalino2;
//    private String identifierBITalino2 = "20:16:07:18:15:94";

...

Code: Select all

//        if(bitalino2 != null){
//            bitalino2.closeReceivers();
//            try {
//                bitalino2.disconnect();
//            } catch (BITalinoException e) {
//                e.printStackTrace();
//            }
//        }

...

Code: Select all

//        if(bitalino2 != null){
//            bitalino2.closeReceivers();
//            try {
//                bitalino2.disconnect();
//            } catch (BITalinoException e) {
//                e.printStackTrace();
//            }
//        }

...

Code: Select all

//        bitalino2 = new BITalinoCommunicationFactory().getCommunication(communication,this, this);

...

Code: Select all

//                        if(identifier.equals(identifierBITalino2) && bitalino2 != null){
//                            try {
//                                bitalino2.start(new int[]{0,1,2,3,4,5}, 1);
//                            } catch (BITalinoException e) {
//                                e.printStackTrace();
//                            }
//                        }

...

Code: Select all

//                try {
//                    bitalino2.connect(identifierBITalino2);
//                } catch (BITalinoException e) {
//                    e.printStackTrace();
//                }

...

Code: Select all

//                try {
//                    bitalino2.disconnect();
//                } catch (BITalinoException e) {
//                    e.printStackTrace();
//                }


You will also need to define the variable identifierBITalino2 with the MAC address of the device that you will not select in the previous activity, where you have the list with the available devices.

Best regards


Return to “Programming APIs”