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.
Related
I am aware that i could just use the playstation app, but I'm specifically looking to be able to enter an account password remotely without showing the password on the android device ,the app should connect to PS4 (as a bluetooth keyboard i guess), then retrieve the password (from a server for example) and then pass it to PS4, there are a few open source projects that allow android to emulate a keyboard but they require root.
If this can't work please specify why you think it can't, that would be very helpful.
It is possible for an android device to emulate a bluetooth keyboard without root after the pie-release, but it is not possible to connect to a PS4 without root, because during the bluetooth discovery phase the PS4 is looking for a Mouse or Keyboard. Phones and tablets will be filtered out, and since you can't change the bluetooth class of device (COD) for your android HID bluetooth app it will not be able to connect over bluetooth.
Is it possible to create an andorid application, that can simulate bluetooth device? I want make Android OS to think, that it is connected to the bluetooth device, which is actualy simulated by my application.
Scenario: user will install my app, and voilĂ , there is my virtual bluetooth device - actually, it is printer. I need it to work on non-rooted devices.
Reason: some guys are too lazy to support other bluetooth printers, so I want to simulate the supported bluetooth printer and print the data on another bluetooth printer.
FYI: I did't found, that it is not possible. I know, that emulator can not simulate it, but ShadowBluetoothAdapter from robolectric can.
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 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'm working on an Android application and I have to make a Bluetooth serial communication between an Android device and a Computer with Ubuntu OS. I don't know what to do and how to connect them. I'm looking for good references and someone who can help me.
I made a button which navigates to the Bluetooth settings of our Android device. I don't know what else I should do.
Pair the devices. This has nothing to do with any software, so it has to be done via the phone settings
Once paired, look at 'Bluetooth Chat' example by Google. It has drop in code for connecting two devices. A serial connection is done via Serial Port Profile that is established over RFCOMM. The UUID for SPP is well known, again, you'll find it in the Bluetooth Chat example.