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
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.
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
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 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.
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.