It's obvious that Android device cannot act as a peripheral device.
But according to this group https://groups.google.com/forum/#!topic/android-platform/obC3g4bU9jU even central device can be made discoverable:
You can expose a server and the other can discover the service even if you are not able to advertise the service.
Can anybody show me, how to achieve this?
The only thing I need is to discover my Android device by another device via Bluetooth Low Energy.
Related
I'm working on a project that requires Bluetooth, however I need it to connect with Bluetooth from my app on one phone to my app on another phone.
Is there a way for Bluetooth to be used on two devices of the same type, or is is just different devices that can connect to each other? Could you please also provide me with a link to Android documentation, if possible?
When using BLE, an Android device can act as a peripheral device, a central device, or both. Peripheral mode lets devices send advertisement packets. Central mode lets devices scan for advertisements
See Device modes.
BluetoothLeAdvertiser enables to turn a supported phone into a peripheral.
See Bluetooth Low Energy Advertising for details.
I am trying to answer the following question?
When two Bluetooth devices are connected, does either of them reply to any Inquiry scan, or send an Inquiry?
I had a few experiments and my answer is no. I connected two BT devices and try to pick any BT device nearby by my other phone which it did not detect any of them.
It would be great if you could also support your answer by a referencable document.
I have looked at several docs like these:
http://essay.utwente.nl/59681/1/MA_scriptie_A_Franssens.pdf
https://link.springer.com/content/pdf/10.1007%2F978-0-387-75462-8_20.pdf
but could not find a straight answer.
Yes, Bluetooth device can scan/enquiry and send scan/enquery response when connected. However, most cells designed so that it can be discovered only when you have Bluetooth settings opened. This is not Bluetooth limitation but OS design.
If we are talking about headsets (or keyboard or any other HID device) then this is reasonable why manufacturer made it so it can pair/work with only single device. But this is just a manufacturer decition and made so by design. It is not Bluetooth limitations. If you need you can design such headset that can be paired and connected to few devices t the same time.
On high-level Bluetooth device can be in Discoverable and/or in Connectable modes. Discoverable mode makes device visible to other devices. Connectable mode allows to connect to the device.
Usually manufacturer design it so that is device is not paired (or when you press special button or open Bluetooth settings on cell) it stays in Discoverable mode. So other devices can discover (find) the headset/cell. Once you paired with your device the Discoverable mode switched off. So now you can connect to device (cause during pairing the MAC is stored and you do not need to rediscover the device).
Once you connected the device turns Connectable mode off so others can't find and connect to it.
But once again. This is how manufacturer designed device. It is not Bluetooth limitation.
Bluetooth Core Specification
I know that you can connect and interact with multiple bluetooth low energy devices without problems. I myself connected to at least three ble devices and could easily receive and send data.
For quite some time now, I have had a keen interest with the Bluetooth Low Energy (BLE) Protocol version 4.0 and how it works. I have developed an android application that would serve as a central device to the BLE peripheral device. The problem is the BLE device is not yet ready and I would like to know if there is a simulator or an emulator for BLE devices that can interact with my android application installed in my smartphone.
The easiest way to do that without any specific additional HW is to use another Android or iOS mobile phone acting as a peripheral emulating the BLE device that's not ready yet. Thus, you'll be able to test your Central role Android app in a simple way.
All you have to do is download one of the following apps for example, set up your services and characteristics and start playing.
[Android]: nRF Connect for Mobile
[iOS]: nRF Connect for Mobile or LightBlue
I have a bluetooth earphones v4.1 which connects directly from phone's bluetooth settings.
but i want to control their connection from a particular app only, that means they wont be able to connect from the mobile settings and will be connected only if the app is running in the background.
please help me solve it, can it be controlled with some changes at hardware firmware level or can be done from the app itself?
Thank you
On iOS, CoreBluetooth is meant to connect only with Bluetooth Low Energy devices. Headsets are not BLE devices, so what you want cannot be done, at least not on iOS
Is it possible to connect BLE sensor device to android watch if the watch has BLE inside, without a phone nearby in the same manner like with a handheld device, i‘ve seen some questions on stackoverflow like this, for example
Is it possible to connect Android Wear device with another BLE device directly without interaction of phone device?
but they weren‘t answered, or the answers weren‘t clear.
Thanks in advance
BLE protocol only allows communication between a central and a peripheral device. The sensor surely is a peripheral device that advertises BLE packets and expose some services (for example the heart rate).
You need to figure out if the android watch support BLE in central mode.
In that case you will be able to scan for advertisement packets coming from peripheral devices (sensors), and connect to them.