I want my app to take care of the bluetooth discovery, pairing and connection process but my current understanding is that in order for my app to see what devices are available to connect to it must have been manually paired through ios Settings first. Is there any way I can achieve my goal without relying on the user to pair first through settings?
https://developer.apple.com/library/content/featuredarticles/ExternalAccessoryPT/Articles/Connecting.html#//apple_ref/doc/uid/TP40009499-SW1
Related
I am working on an audio device project with dual-mode Bluetooth. I want to create a seamless connection experience with iOS devices, so I use CTKD with iOS. This gives us the ability to connect both BR/EDR and BLE without leaving our app in the system settings.
It works perfectly if the initial pairing happened inside the app. I got both BR/EDR and BLE connected and working and only one device shows on the Bluetooth page.
But if I pair the Bluetooth(BR/EDR) first in the system settings and then go to the app to pair BLE. The app initiated a new CTKD process, which creates a new BLE connection beside the BR/EDR connection.
My question is if I pair BR/EDR first in the Bluetooth settings, is there a way that I can only pair BLE and didn't trigger the CTKD while keeping the one device displayed on the Bluetooth settings page? Or anything else that can get the same result?
We are working in Blood pressure monitor project . we have implemented GATT protocol in our device to communicate with iphone / iPad . so far we are using Core bluetooth framework to communicate with our device ,Its working fine in data transmitting.
But our device is not visible / listing in iPhone Bluetooth in the settings page.
please note that we are not using any MFI chip.
Please advice what we needs to be done to make our device visible in iphone's bluetooth settings page without using MFI chip.
In order for your BLE device to show up in iOS Bluetooth settings, it has to have gone through the pairing process, as stated by Larme.
To do so, the device must have one or more characteristics that are encrypted. When your app tries to read/write/indicate on that characteristic, the read will fail with an Insufficient Authentication error code, which will then should start the pairing process. See section 25.10 in Apple's Accessory Design Guidelines - https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf
Once the user has selected to Pair in the dialog, keys are exchanged to finish the pairing process. Your device will show up in Bluetooth settings at that point.
Is there a specific reason that you want the device to show up in Bluetooth settings?
I'm trying to set up a hobby project and I'm wondering - if my device uses Bluetooth Low Energy module, will this device show under the list of Bluetooth Devices under Settings for iOS? Or will my app have to search for this device specifically before connecting? If it doesn't show in the Settings, what type of Bluetooth module would I need for that?
No, you will not see your LE devices under Settings for iOS.
See LE best practices - your app should search for the LE device.
You only see the BT classic devices in that settings. However, only few protocols could be used without a required MFi chip, which is out of your scope for your Hobby project.
Use The CoreBluetooth on the iOS side for your app.
UPDATE per #Brejuro request in the comment below:
MFi coprocessor is required to be in your custom HW, which wants to communicate using the majority of profiles/protocols defined for Bluetooth Classic (not LE), e.g the pure RFCOMM. Coprocessor is used for the initial authentication - then, iOS knows that your custom HW is certified and allows to use it.
However, Apple will ask you for big money and your device needs to pass through Apple certification - that's why I told that this is out of the scope for any hobby project. You will also need to sign very restrictive NDA. However, you will get very very good documentation describing many details.
Built-in Bluetooth panel in iOS Settings app is actually a merge of two different things:
a list of known (paired) devices whatever the profile they use (so that you have a central place to unpair them),
a tool for discovering nearby devices to pair to.
Unpaired devices will only show in discovery list if they actually implement at least one profile that is recognized by core bluetooth services of iOS. Other devices are masked (user would not be able to do anything useful with them anyway).
If you hobby project is to do something related to built-in supported devices, like HID (keyboard, mouse, remote control, etc.), you will actually see them during discovery from Settings app.
If you create a device with a custom service, with your own Service Type UUID, it will not show in built-in panel, and your app will have to look for it for pairing. Once paired, device will show in settings.
Out of core services, you can also make compatible devices without being MFi. For instance, MIDI over BLE profile is such thing that gets recognized transparently by garageband and other music apps.
Using BLE and not BR/EDR, Authentication chip is only required for very specific profiles, like HomeKit.
We are building a custom Bluetooth device that supports both Bluetooth Classic for Handsfree as well as Bluetooth LE for other features. I am able to connect and communicate with the device via Bluetooth LE however, right now the user must manually pair with the device from Settings in order for the handsfree stuff to work. Like the Apple Watch, is it possible to automatically pair with the device via Bluetooth Classic when the device is selected from the Bluetooth LE list of available devices?
Basically, here is how we want it to work.
User launches application for the first time.
User is redirected to registration screen and registers their phone with our environment.
User is taken to the applications Dashboard and then clicks the applications Settings button.
In Settings, the user clicks Bluetooth Peripherals and is taken to a screen with a list of the BLE devices in range.
Here is where the new magic needs to happen:
User chooses BLE device, the devices is discovered and connected to via BLE.
After the devices characteristics have been discovered, the application should pair with the device via Bluetooth Classic for the handsfree stuff to work such as the microphone and speaker.
Any help is appreciated.
I have looked into the External Accessory framework however, I was unable to get it to even work properly. The application kept failing telling me "init" was not available or something.
Thank you.
We're trying to do the same thing and it looks like you can only pair a hands-free device working via HFP profile if leaving your app, going to Bluetooth settings in Settings.app and tapping the device there. From the app it's absolutely impossible. All the hands-free vendors I checked recently (Jabra, Parrot, etc.) do it this way.
The only thing I can think about would be pair via BLE, send the iPhone name to your hands-free accessory via BLE open Bluetooth settings screen in the Settings.app and wait for the accessory to discover the iPhone and connect to it from its side. This will save your user a tap, but he will still have to open the Settings.app (manually, bloody hell, not even via a system alert).
ExternalAccessory.framework is used to connect with devices registered in MFi program. It has absolutely nothing to do with hands-free devices working with HFP profile.
Can you pair a bluetooth LE device in an iOS app, i.e. not via Settings. Trying to make it easier on the user to pair with a specific device.
If so how?
You don't pair Bluetooth LE devices through system settings. Generally you don't pair with Bluetooth Low Energy devices at all. The only time that pairing is required is when the device has an attribute that is marked as encryption required - attempting to read this attribute will trigger a pairing process, but before you can read you need to discover and connect to the device.
Discovery and connection is handled by the Core-Bluetooth framework.
The Core Bluetooth Programming Guide goes through the steps required to use a CBCentralManager to discover and connect to a BLE peripheral.
According to the BT SIG Security Manager documentation you can pair/Bond ble devices if they respond to the message that is.
You can also wait and do it as previously explained from the peripheral side. Some devices like HipKey does this automatically when connecting first time.
Look at BTSIG Security Manager specifications.
On Android this also works from BT settings menu IF the peripheral supports it.
Bonding and Authenticating are usually confused but om most platforms it means the same.
A good way to try this out is by buying the TI ble development kit. Its cheap. It comes with a USB dongle and SW which can be used to initiate pairing like from the settings menu.
To do it from iOS just connect and read a known encrypted characteristic.
Cases where you want to "pair" (remember a Bond) includes Pulse meters, hearing aid, keyboard and other private units.