I'm working on an app on Android that is supposed to connect to a custom device via Bluetooth, but in order to emulate that device (which I don't have yet), I made a simulator on PC, using Java's Bluecove.
However, I'm having a hard time figuring out the different connection's method.
First, on Android, we discover the device (here, a PC), then:
-We have the "UUID" solution, as explain in android sdk doc.
-Or the "Port" solution, as proposed here.
The second one seems more natural to me, as I don't quite understand what is a UUID in this scenario.
I do understand that we need to connect to a port of a device, but what does the UUID have to do with that? Why don't we need to specify it in the second solution?
If someone could give me a clue, that would be greatly appreciated :)
bluetooth communication is communication with service, so when you wanna connect to device you are attempting to connect to service,and uuid is number with which we connect to service, like ok, i wanna this uuid(this service).
Related
I need to make communication between PC software (written in java) and android app over usb cable. The PC software will send some data (Strings) to Android app witch will accept those strings and do some action depending on the message received.
What is the best way to do this?
I am looking all over the internet and can't find any solution to this. If someone has example of this communication i would be very grateful.
I already done this communication over sockets, put i need to cover situation if there is no router or internet connection.
Thank you
Check following article. I guess similar question to your on SO.
If you want to communicate between Android USB device and some USB host you need to use the accessory mode (https://developer.android.com/guide/topics/connectivity/usb/). But this mode requires special driver support on the USB host side (which is your PC).
I was searching a way to bypass the WPS dialog while two devices are connecting via wifi p2p. Right now, everytime when two devices are trying to connect with each other, I have to choose one of the WPS methods. Yet I don't want any of these.
I am aiming to connect multiple device via wifip2p without notify users, as long as they are running my program.
PS: only via wifip2p, not via Wifi.
Please, any help will be great.
Is there an alternative to using Google C2DM for push notifications with Android? I ask because the app I'm working on will only run when the device is connected to a specific network. It's an app for members of this specific company and notifications will only come from that companies server. Since everything is "in-house" does it even make sense to push them to google just to have them come back to the same network? I've heard something about JMS. Does anyone know if that will work?
There are definitely some options. I played with UrbanAirship a bit and it seems nice. Check it out http://urbanairship.com/
You can try Tokudu . It uses IBM’s MQTT broker to handle the server work. Try it out.
I'm working with an android 4.0.3 tablet. I need it to communicate with a custom made board via USB serial at 9600 baud rate. The custom board's usb port allows serial connection. I was wondering of someone can point me in the direction on how i can get my application on my tablet to send and receive some information between the two. All the help is appreciated.
Dogz1
You should use USB Host API for doing this. The API documentation explain how to use the USB Host API, step by step in the official documentation page here : http://developer.android.com/guide/topics/usb/host.html
Also if you are working with something like an Arduino Board, and if your board has USB host capability, I would recomment using ADK for communication.
I am developing an application which uses Bluetooth to connect to a device and send/receive data. I am doing all of my testing with a Nexus One phone.
I have never been able to establish a SPP (serial port) connection from my phone to any device. However, I have been able to connect from a device (my laptop) to my phone using a Mac equivalent of PuTTY (The only exception to this is the "Bluetooth File Transfer" app from the Marketplace seems to work, but I don't think that uses RFCOM/SPP...).
I keep seeing this message in my LogCat logs:
ERROR/BluetoothService.cpp(78): stopDiscoveryNative: D-Bus error in StopDiscovery: org.bluez.Error.Failed (Invalid discovery session)
as well as these:
java.io.IOException: Operation Canceled
java.io.IOException: Software caused connection abort
I have tried using the UUID of "00001101-0000-1000-8000-00805F9B34FB" and I have also tried using the:
Method m = device.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
sock = (BluetoothSocket) m.invoke(device, Integer.valueOf(1));
method instead of device.createRfcommSocketToServiceRecord(UUID); as well--with no luck.
I am using the BluetoothChat example and variations of that code to do all of my testing...
Solutions or suggestions would be great...or even a better/less complex example of some testing code I can run on the phone, or a python script or something I can run on my computer to help debug?
Thanks! I hope this isn't a bug with the Android OS, but if it is I hope to find a workaround.
EDIT: I should also note that most devices show up as "paired, but not connected" in the Bluetooth settings.
EDIT 2: The solution seems to be simply disabling any Bluetooth listening. See my answer post for more information.
The solution, as it turns out, was to disable the server functionality of the Bluetooth service. By only using createRfcommSocketToServiceRecord and never calling listenUsingRfcommWithServiceRecord (in the BluetoothChat example this means never starting the "AcceptThread") the problem was fixed.
Even though these two calls are supposed to be totally separated and have no affect on each other (according to the Android docs), simply commenting out listenUsingRfcommWithServiceRecord fixed my supposedly unrelated issue.
I can take the Bluetooth Chat program unedited and it will not be able to establish an outgoing connection to ANY bluetooth device I have tested (laptops, desktops, headsets, etc.), but if I remove that one thing it works flawlessly as a client.
Anyway, I hope this will help someone else if they come across the same issue. This must be a bug with the Android OS, or possibly the firmware on the Nexus One.
I would ignore the stopDiscovery error - its good that you're cancelling discovery before making your connection. Per the SDK docs:
Because discovery is a heavyweight
precedure for the Bluetooth adapter,
this method should always be called
before attempting to connect to a
remote device with connect().
Discovery is not managed by the
Activity, but is run as a system
service, so an application should
always call cancel discovery even if
it did not directly request a
discovery, just to be sure.
So with that said, were you able to get the Bluetooth Chat example to work before you made any modifications to the code?
The UUID you want for SPP/RFCOMM is:
static UUID UUID_RFCOMM_GENERIC = new UUID(0x0000110100001000L,0x800000805F9B34FBL);
or defined another way (both accomplish the same thing).
static final UUID UUID_RFCOMM_GENERIC = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");