Can someone point me in the right direction please?!
I am trying to connect to an industrial product using Android over Bluetooth. The device does not support pairing. I have written an application in WM6.5 and that works fine.
The sequence of events is:
Discover device and establish a Bluetooth Serial connection (the device does not support passkeys/pairing).
Request a key from the product (by sending a hex string)
Read string and send back a response based on the key and a user entered password (by responding with another hex string).
Is there an example anywhere that I can download?
I have downloaded some BT serial terminal emulators but they all want to pair with the device.
In Windows 7 you can simply search, connect and choose to connect without pairing and then the device appear as a BT serial port.
Thanks in advance.
Pairing is not something that a remote device either supports or doesn't support. Your Android can pair to any Bluetooth device it finds. This only means that it records the device's MAC address and friendly name for future reference. If your device has a PIN you may need to enter that at pairing time and the Android will record that too.
Related
I am writing an Android app that acts as a BLE peripheral.
When I connect to it using another device it always requests pairing. How do I make it so that it won't require pairing?
I have a single service and single characteristic and the permission on it are just normal read and write. I am not requesting any encrypted version of those.
Every device has mac address, connection is made by using mac addresss.
Connect to device and Save connected device mac address in shread preference so every time it will connect to that save device only.
So it will not ask pairing every time.
If you want to disconnect that device , in disconnect method clear mac address from shread preference.
I hope this will work for you.
I have HID BLE keyboard which normally when I want to connect to it in android os environment, I go to Bluetooth page, search for it then tap on keyboard name and connect to it.
now I want to know that can I write an app that automatically finds the device and then connect to it as an input device or not?
I'm already read the documents about BLE communication in Android, but none of them does not explain how to connect HID keyboard as an input device looks like android itself connect to it.
No the public API does not allow you to activate the "use as only device" switch shown in the Android Bluetooth Settings UI.
However up to Nougat you can do it with Reflection. Just read the source code of the Settings app and do the same thing.
Yes! you can search the nearby bluetooth devices and you can connect to the device.
The transmitting of data is depends on the Device UUID. as per bluetooth standards bluetooth UUID standards you need to use UUID = 00000011-0000-1000-8000-00805F9B34FB to connect HID devices
Here is the link for a sample project.
I am developing a solution for connection between OBD2(Vehicle ECU scanner) with the mobile app.
I want that when ever that OBD device is found and it is already paired then the application automatically connect with the device and create a socket for transmission of data . without showing the dialog box to choose a paired device.
You can connect to any paired Bluetooth device, to do so, you have to know device's address and UUID. Embedded devices may have some defined uuid (for example, hc05 adapter), you can get that uuid from documentation.
The tricky part here is that you have to monitor failure and loss of connection so you can retry again. I'm implementing that feature in my home project, fell free to see code: https://github.com/AlexShutov/LEDLights
I have a device. I use microcontroller arduino. I have connected my device with my android application via bluetooth. And I want to do that only my application can connect to my device. What is the best way to do this authentification? Can I do this with bluetooth's special AT commands? If yes how? Or must I send some key to the arduino from the application and check it?
By defaukt bluetooth adapters accept all connections (no binding), so you have tobcheck if this is the right device explicitly. You can store data persistently in eeprom on microcontroller, where you should keep your app key. When new phone try to connect to your device you should check if device passed that key and if not, do nothing in response.
I'am trying to make an app that receives some binary data from a other device which is not running android. The Android phone should not transfer any data to this device. So over to my questions:
Should the phone act as the server which establishes the RCOMM channel?
Is it possible to connect the phone and this device without paring, as long as I know the MAC-address of the device? If so, how?
And yes, I have read http://developer.android.com/guide/topics/connectivity/bluetooth.html so no need to only answer with that link. :)
Thanks in advance!
1)
Phone should act as a receiver.
I found that the tricky part is to use correct UUID.
If you connect two phones you should be generating those and everything work fine, but on your hardware you can't change UUID that easily.
Take a look at these reserved UUIDs.
For a Serial Port Profile's (SPP) communication use UUID 00001101-0000-1000-8000-00805F9B34FB.
2)
You can connect to a device without pairing if you already know the MAC address, you don't even need to use BlueTooth discovery.
To get device using MAC address call getRemoteDevice(String)
and then createRfcommSocketToServiceRecord(UUID) to get BlueToothSocket.
Also take a look at checkBluetoothAddress(String) to validate MAC address.