Many of us have used bluetooth headset/earphones or alike devices having in-built programmed A2DP (advanced audio directing profile) so that they can recieve streaming audio from a standard device.
But I wanted to design (code and implement) my own bluetooth A2DP profile using java which can be installed on a mobile device so that very device can recieve and ouput streaming audio recieved from another device.
For instance: My laptop has a bluetooth stack as well as my cellphone has.
As an ordinary cellphone it does not have a A2DP profile
But what if my cellphone is connected to an amplifier and I want to dorect my laptop's audio to that amplifier wirelessly.
Proposition: if I design a installable java based (java, because its widely accepted as mobile device's supportive language) A2DP bluetooth profile then my cellphone can be used as a bluetooth based audio reciever.
But the main question is how and from where to start off?
why do not you use your Bluetooth Headset instead.This ways you can connect your bluetooth device to Amplifier and it can stream audio from both your cell as well as laptop.
Related
Following is the scenario:
Headphones with mic are connected to a mobile device.
What i want to achieve programmatically:
After a call is been initiated, audio from 3.5mm jack should (forcefully) be routed to mobile earpiece rather then headphone speakers, while the mic should be used of the headphones.
I have searched a lot on google but found methods only to forcefully turn on mobile external speakers.
Reference : how to turn speaker on/off programmatically in android 4.0
While, my goal is to turn on earpiece forcefully.
My research from google:
To achieve this there might be possibilities of system (root) permissions, which a third party application might need.
You may have to write a modified audio driver from sources ? As the functionality is based on the operating system.
If it is possible, can any one guide me on this ?
UPDATE
One more reference: Android - Getting audio to play through earpiece
But the above code does not work on all phones.
I have a project where I want to implement live audio stream from users with Android phones in my LAN Network and receive them in my laptop, off which I can filter, reduce noise, control volumes of each and write the audio to the speakers.
Please help. If possible Android and Java.
I use the following code for an Arduino Uno:
#include <SoftwareSerial.h>
SoftwareSerial device(2, 3);
void setup()
{
device.begin(9600);
}
void loop()
{
device.println("33,89,156,203,978,0,0;");
}
No specific device to send to is set.
If I want to receive the data on my laptop (running Ubuntu 14.04) I simply call:
sudo rfcomm bind rfcomm0 [MAC ADDRESS] 1
and
screen /dev/rfcomm0
in another terminal instance and it works.
How can I achieve the same behaviour with an Android app?
The following example code specifies a device. I cannot find any other code. Additionally it only works when I listen on the laptop for an incoming connection like this:
sudo rfcomm listen rfcomm0 [MAC ADDRESS]
I want my Android app to work exactly like the Arduino example. How can I achieve that?
Unfortunately Android doesn't appear to have low level Classic Bluetooth APIs which would allow you to do broadcast type behavior. This makes some sense as Android is intended to go into a power limited devices and active radios use energy. If you are required to use Classic Bluetooth (3.x) and Android to handle sending or receiving broadcast type behavior you'll probably need to write a custom ROM.
However there is specification called Bluetooth Low Energy (4.x) allows for less energy consumption but slower/less data throughput. Specifically the Advertising mode. Android devices which are scanning can pick up the short advertised data packet broadcasted by a device called a 'beacon'. Protocols which use this mode are Apple's iBeacon and Google's Eddystone.
Look here for sample apps involving Advertisements:
https://github.com/googlesamples/android-BluetoothAdvertisements
https://github.com/devunwired/accessory-samples/blob/master/bluetoothadvertiser
Also note that Android devices don't always support BLE Peripheral Mode which is what you will need for your Android device to act like beacon.
Related link:
Can an Android device act as an iBeacon?
And a nice list of what devices have been tested:
http://altbeacon.github.io/android-beacon-library/beacon-transmitter-devices.html
So in your case you should still be able to use your Sony Xperia Z3 as a Scanner, but will have to buy/build a beacon for testing.
Before I even attempt to write this android app, I need to know if its possible to do the following with the standard Android SDK library or any known 3rd party library.
Output audio from multiple simultaneuosly playing files to both the wired headphone jack AND bluetooth A2DP at the same time.
Each file/output combination will have its own volume control in the app as well. So if the volume on file 1 is turned down on the headphones but not the bluetooth volume, it still can be heard on a bluetooth speaker but not in the headphones. Same would apply on file 2,3,4 etc
I want one Android device to be a "host" device that transmits streaming audio data to x amount of other devices that have connected to the host device. I have an app that does this on iOS, but I'm unsure of how to approach this on Android.
Is it possible to stream audio from one device to x amount of other devices via bluetooth?
If so does Android have any built-in tools for transmitting data and connecting MULTIPLE bluetooth devices to each other?
As for the streaming, I imagine I would need to "packetize" the audio file and send it to the other devices. Does Android have a tool for reading streaming data?
It would be nice if there are some libraries available for this type of work.