Android: Two Bluetooth modules - android

I am in the planning stages of a project and potential issue has come up and I can't find the answer.
I am going to use a raspberry pi 4 with Android installed. To achieve my goal I will have to use a Bluetooth USB adapter with an external aerial. Because the raspberry and pi already has an onboard Bluetooth module, how will the OS cope with a second module being plugged in?
Can I disable the on board Bluetooth or force Android to use a particular module exclusively e.g the usb module?
Thanks

Unfortunately this is either not doable or at least not straight-forward. The reason is that the Android OS was designed to have one adapter only that does the Bluetooth functionality (as can be seen here and here). Even if you find a way to do it on the OS level, I would personally advice against it as there's very little resources on how that is done and you might soon find yourself stuck on another issue.
Is there a reason why you wouldn't use Linux and the BlueZ stack instead? There are many resources and examples on how to do this and with BlueZ and you should be able to use multiple adapters without an issue. If using Android is a must, then another recommendation is to use another MCU to connect to the Bluetooth dongle and do the translation from BT/USB and then have the Raspberry Pi connected to the external MCU over USB.
Below are a few links with people having a similar problem:-
How to use two Bluetooth adapters in Android
Are multiple Bluetooth adapters under Android possible

If the Android version doesn't matter, there's even AOSP BlueZ for Android.

Related

The value send by a USB barcode scanner [duplicate]

I have one custom made device for measuring current. This device can be connected to PC and communication is done over USB. It is based on FTDI chip. I have application written in Java and that application is using rxtxSerial.dll library and gnu.io.rxtx_2.1.7.4.jar. Now I want to port this application on my android device and I'm litte bit confused what to do that? All I have is android tablet (os version 4.1.1), OTG cable and this measuring device.
Should my device be rooted? Is there any kind of library that I can simply add to my Java Android application and read data over USB? Where to start?
I have tried to port existing application for PC using same library, but rxtxSerial.dll is missing and I can't transfer it to my android device.
I can really recommend the USB-Serial-For-Android library, it supports multiple popular usb-to-serial chips (also FTDI) and there is no rooting required. Check out the GitHub project here.
There is a project dedicated to serial communication on Android. android-serialport-api. I think, it is a good resource to start with.
FTDI also provides Android related resources.
I think there's currently only one properly maintained library for serial USB communication and it's felHR85/UsbSerial. It supports several USB chips including FTDI (see Devices Supported).
Unfortunately mik3y/usb-serial-for-android seems to be dead.
And no, you don't need to root your device for connecting to and communicating with a USB device.
EDIT: We have a maintained fork of mik3y's library. See kai-morich/usb-serial-for-android
EDIT2: It seems that all of these libraries are maintained again, mik3y joined forces with kai-morich and they are working together.

Communicating with serial USB device over Android

I have one custom made device for measuring current. This device can be connected to PC and communication is done over USB. It is based on FTDI chip. I have application written in Java and that application is using rxtxSerial.dll library and gnu.io.rxtx_2.1.7.4.jar. Now I want to port this application on my android device and I'm litte bit confused what to do that? All I have is android tablet (os version 4.1.1), OTG cable and this measuring device.
Should my device be rooted? Is there any kind of library that I can simply add to my Java Android application and read data over USB? Where to start?
I have tried to port existing application for PC using same library, but rxtxSerial.dll is missing and I can't transfer it to my android device.
I can really recommend the USB-Serial-For-Android library, it supports multiple popular usb-to-serial chips (also FTDI) and there is no rooting required. Check out the GitHub project here.
There is a project dedicated to serial communication on Android. android-serialport-api. I think, it is a good resource to start with.
FTDI also provides Android related resources.
I think there's currently only one properly maintained library for serial USB communication and it's felHR85/UsbSerial. It supports several USB chips including FTDI (see Devices Supported).
Unfortunately mik3y/usb-serial-for-android seems to be dead.
And no, you don't need to root your device for connecting to and communicating with a USB device.
EDIT: We have a maintained fork of mik3y's library. See kai-morich/usb-serial-for-android
EDIT2: It seems that all of these libraries are maintained again, mik3y joined forces with kai-morich and they are working together.

Communicating with an xbee module using Android 3+ phone

I want to connect my Xbee module to my android phone and communicate with it by sending AT commands.
I do know of the USB host facility provided by Android phones, but I do not know how to send data to it.
I have the java-Xbee API and I am able to talk to the Xbee using my computer but since my project involves using the Android OS, any help on this topic will be appreciated.
According to this Google Code Page, the java-Xbee API requires Java >= 5 and RXTX. Considering those two requirements:-
RXTX on android is not an out of the box lib and may require some hacking which may or may not work.
I'm not a Java VM expert, but i know desktop OS JVMs work differently from Dalvik.How well would Dalvik run code developed for JVM? Here is a nice StackOverflow topic discussing the two.
Faced with the above challanges, are you brave enough to boldly go where no man has gone before?
Could you also consider the following well documented and supported approaches:-
Ytai Ben-Tsvi & Sparkfun's IOIO-OTG
Saves you the headache writing android 3.1+ USB host code and thus allows you to use cheaper phones that run droids 1.5 to 2.3 (without hacking the latter).
Digi's WiFi to Xbee
Allows you to link your android phone (or any other programmable wifi enabled computer) to your device over the internet.

Connecting two android devices together via USB

Is it possible to communicate between two android devices connected together via USB. This is assuming they are both devices with USB OTG and have kernels that support it.
I've tried searching for this but cannot find a good starting point. I'd assume that one of the devices needs to act as a host and one as a client which is exactly what I need (only really require one way communication actually).
I tried connecting two phones (one running ICS and the other JB) using a male-A-to-male-microB cable coupled with a female-A-to-male-microB adapter, and one of the phones detected the other one as a USB device.
Whether I'd actually be able to communicate between them somehow is a different matter. Perhaps the Android developers documentation on this subject could be of some help.
You can use mobodaemon for android.

How to send Bluetooth AVRCP vendor dependent and pass through commands from app?

I would like to communicate with another Bluetooth device using the AVRCP vendor dependent or pass through command. From the API available, there does not seem to be any way to make such calls from an android application. Can anyone advise on whether this is possible and how this can be done if it is possible?
What you should do is to go directly and speak with the HCI layer of the BlueZ Bluetooth stack. You could do this through D-Buss daemon which you can do it from Userspace. Next you take the ARVCP specs for example 1.0, but you can find on Bluetooth SIG AVRCP 1.3 or 1.4 specs too, and start parsing the commands. This presentation should be helpful: Android Bluetooth Introduction and this stackoverflow question.
Refer the below link:
Adding AVRCP Plugin in Android GB
It seems like you confront the most common problem between Bluetooth devices, the Bluetooth compatible problem. Because the Bluetooth profiles do not strictly defined the audio related behaviors, the different behaviors implemented by different manufacturer would lead this problem. That's why every Bluetooth device should pass the Bluetooth Compatible Test of Bluetooth organization, however, it can not eliminate all problems.
As an open source implementation of Bluetooth Protocol Stack, Blue Z is not the best one in my mind and abnormal behavior of Bluetooth device also making trouble. If you have some test tool like PTS (profile tuning suite), try to use it to find out which side lead the problem. If everything is ok in profile side, that's good news for you, the problem may lead by some bugs of the related application. And if something wrong in the profile communication, it means you can not modified in API level, you may need some dirty work in profile stack and if you are phone manufacturer it can solve you problem, if you are not you can not slove the problem neither.

Categories

Resources