I am making an Android Bluetooth app which will send and receive data from 2 Arduino devices simultaneously.
I am able to connect either one of the devices (sender or receiver), but I cannot connect to both of them and send and receive data at the same time.
Any link, any reference app, any documentation would be highly appreciated.
Thank you.
NOT SURE you can connect with 2 devices at the same time. you might
connect to one and disconnect and do the same with the second.
i'm trying to do the same things with 2 arduino. but at this time i can connect
to one arduino, but i don't know how to disconnect .
i'm using " Androidapi.JNI.BluetoothAdapter.hpp"?
how do you disconnect your sock??
Related
I want to transmit some data (text) between android devices.
Like zapya or shareIt applications.
I don't want to connect each device to a same modem.
I want just to connect two devices over wifi and send/receive data between them.
How can i implement this in android ?
Thanks in advance :)
You'll find what you're looking for here Wifi P2P Android
You can create a peer to peer network between two devices that support it and send arbritrary data between both
I need to connect multiple phones to each other using wifi, without there being any internet though.
So i was thinking if this can be done by turning on the hotspot on one phone and allow the others to connect to it, can this be done ?
Or is there any other way to connect multiple phones via wifi ?
Any help is appreciated .. thnQ
To send and receive UDP messages you can using the following technique:
https://code.google.com/p/boxeeremote/wiki/AndroidUDP
The simplest way to explain this is that the UDP packages can be transmitted on a network with no particular destination set. Applications can pick this up and then decide if they want to handle the message or not.
To connect the devices you can use either a mifi dongle or put one of the phones into tethering mode:
https://support.google.com/nexus/answer/2812516?hl=en
Of course this is limited in range to the hosting mifi or phone.
I am a little confused on how to build this android app. Here's how it should work. I have a list of paired bluetooth devices. Lets say paired devices are:
1. A bluetooth head set.
2. A mobile phone.
And my app should automatically connect only to my headset when ever it comes in range.
Thats the basic functionality. I have been doing some research on bluetooth technology and its implementation. I came across the bluetooth chat application, when I started using the application I realized that both phones should have the app on it in order to connect and exchange messages. I tried connecting to my headset but it doesnt connect. And also when I removed the bluetooth chat app from one of my device and tried to connect it from a device which had bluetooth chat app, the devices couldnt connect.
If you have already worked on bluetooth this might look very simple. But how can I connect to a bluetooth device from my app when ever its in range even if the other device doesnt have my app.
Thanks.
This will be a 2 sections answer:
-To connect to a Bluetooth Headset, check my answer on here
-To Always connect to that device, you can save device address to memory then create a service with BroadCastReciever that listens for Bluetooth Connectivity. and check which device gets connected and compare it address to the one save in memory once its finds it connected call ibth.connect(device). ibth is inside the above link.
I want to create a connection between my Android and a PC (or another device) just like in the Bluetooth menu from settings.
I have manage to get the list of all bt devices in my range and get their MAC addresses.
So, I have the BluetoothDevice, how can i connect to it or pair with it? I saw a lot of stuff about creating a server on PC, but I don't want that, i just wanna connect with the device.
My attempt were to get the UUID of the device and use createRfcommSocketToServiceRecord...but when i try socket.connect() it cannot connect (because I don't have a server). So practically I need to make the same structure that the OS is doing (connect with the device, if the connected device is trying to send i can receive the info and so on).
If I managed to connect with the device, I want to listen all that it is emitting, no matter the data...I haven't researched this topic, but any advice will be nice.
The connection must be made with any device that supports bluetooth, and I don't have access to it (of course the device is giving me the permission to connect).
Grab the Android sample projects by doing this http://developer.android.com/tools/samples/index.html
They have an app called BluetoothChat that pretty much does just what you want.
The thing about the 'server' is just in the connection, one side needs to open a listening port and that side is arbitrarily the 'server'. Once they are connected they are merely peers and you can write/read data till the cows come home.
I have Ardunio board.I want to connect this Board through my application Via Bluetooth,and want to send my Tweets in this Ardunio board. Is this possible?
Please reply,
Thank you
I'm assuming that you already have a bluetooth shield for your Arduino, if not, then you must get one. Sparkfun carries a variety of different ones, I like to use the following: http://iteadstudio.com/store/index.php?main_page=product_info&cPath=18%E2%88%8Fucts_id=307
These will allow serial communication with your Arduino. The example bluetooth code: http://developer.android.com/resources/samples/BluetoothChat/index.html can be used "as is" to send messages to the Arduino for testing. You can also easily modify this example to meet your needs.
You will use the device acitity list code to detect your device and get the MAC address which is used to initiate the connection to your bluetooth shield. The service code allows you to connect, send and receive messages from the bluetooth device.
On the Arduino side you simply need to read and write via serial to send and receive the data.