Reading realtime Bitalino data when building an android app

Python, Java, Android OS, etc.
Jasmine
Posts: 5
Joined: Thu Apr 28, 2016 3:27 pm

Reading realtime Bitalino data when building an android app

Postby Jasmine » Thu Apr 28, 2016 5:28 pm

Hi,
I am currently building a project in Ubiquitous Computing. I am trying to make an application that launches when certain thresholds detected by the sensors are met. Specifically heart rate (EMG) and accelerometer data. However, I am unsure as to how to read and import realtime bitalino data without having to manually type in the raw data. I am using the Java SDK, Bitadroid app, and editing in android studio. If you could point me in the right direction, that would be appreciated. Thank you! :D

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

Re: Reading realtime Bitalino data when building an android app

Postby BITalino » Thu Apr 28, 2016 9:17 pm

Hi Jasmine,

Great to hear about your project... looks really cool. I'd suggest you contact the authors of the Java SDK and BITadroid app:
https://github.com/pires
https://github.com/DavidGMarquez or https://play.google.com/store/apps/details?id=ceu.marten.bitadroid&hl=en

They're amazing people and usually reply fast to the questions posed by BITalino users. Let us know in case you need additional support.

Best regards,
The BITalino Team

Jasmine
Posts: 5
Joined: Thu Apr 28, 2016 3:27 pm

Re: Reading realtime Bitalino data when building an android app

Postby Jasmine » Thu Apr 28, 2016 10:02 pm

Alright thank you very much!

Jasmine
Posts: 5
Joined: Thu Apr 28, 2016 3:27 pm

Re: Reading realtime Bitalino data when building an android app

Postby Jasmine » Fri Apr 29, 2016 2:20 am

Also, this is part of the code in the BITalinoFrame.java, and I got a problem when I am importing:

Code: Select all

import com.google.common.base.Objects
;
Android studio said that "cannot resolve symbol "Objects"", so how can I resolve this?

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

Re: Reading realtime Bitalino data when building an android app

Postby BITalino » Fri Apr 29, 2016 7:24 am

Please confirm that you have all the dependencies and followed the instructions listed here:
https://github.com/BITalinoWorld/android-example

Jasmine
Posts: 5
Joined: Thu Apr 28, 2016 3:27 pm

Re: Reading realtime Bitalino data when building an android app

Postby Jasmine » Wed May 04, 2016 2:01 am

Hi Bitalino team,
I am facing another problem. When I tried to initialize a BITalinoDevice, it throws a BITalinoException.

Code: Select all

 BITalinoDevice bitalino = new BITalinoDevice(1000, new int[]{0, 1, 2, 3, 4, 5});


It's not a runtime error, it couldn't even compile because there's a red line stressing the initialization. I tried a lot of different approaches but it just doesn't work so I am a bit stuck.Can you help me with this? Thank you very much!

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

Re: Reading realtime Bitalino data when building an android app

Postby BITalino » Wed May 04, 2016 5:53 am

Hi,

Do you have any additional information on the exception? Can you confirm that you have the device paired with your phone?

The line that you have posted appears to be in accordance with the Android example made available by Paulo Pires, the creator of the SDK.

From what we understood its a compiling error, correct? Are you sure that the error is in that line and not on the previous?

Best regards,
The BITalino Team

Jasmine
Posts: 5
Joined: Thu Apr 28, 2016 3:27 pm

Re: Reading realtime Bitalino data when building an android app

Postby Jasmine » Wed May 04, 2016 1:32 pm

It just says Unhandled exception: BITalinoException. I looked at the BITalinoDevice.java file and it says:
@throws com.bitalino.comm.BITalinoException
* if analog channels are not valid.

But I could not figure how the numbers I input are not valid.

And yes I am sure that the device is paired with my phone. Also, if it's not, I guess it would be a runtime error instead of compiling error?

And I am sure that the red line is under

Code: Select all

new BITalinoDevice(1000, new int[]{0,1,2,3});

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

Re: Reading realtime Bitalino data when building an android app

Postby BITalino » Wed May 04, 2016 7:00 pm

That exception should be thrown when the list of analog channels has zero or more than 6 elements, or when the channel number is below 0 or above 5.

As far as we can see, the code snippet you've shared appears to fulfil all conditions. The best would really be for you to reach to Pires to confirm.

Best regards,
The BITalino Team


Return to “Programming APIs”




cron