18

We have a bondable (when we connect we are asked to Pair, see question 2) Bluetooth 4.0 peripheral that we have manufactured and have written an iOS app for.

Question 1

Is it possible in iOS 6 with CoreBluetooth to remove our peripheral from the iOS Bluetooth Settings from within our app or is this restricted to only going to iOS Settings / Bluetooth / Our Peripheral and "Forget this device".

What we are trying to do is when we remove our peripheral from within our app, we expect this peripheral to be removed from the iOS Bluetooth list as well.

Question 2

My second question is, does iOS SDK provide a way to determine if a user has chosen "Pair" or "Cancel" on the Pairing request alert? As of now, we determine the user pressed pair by reading our services / characteristics when the device is connected.

Pairing example

WrightsCS
  • 49,871
  • 22
  • 132
  • 180
  • 2
    to sort of answer q1, my reading of the documentation is that there is no way via iOS SDK to perform a "Forget this device" other than what you have mentioned. to sort of answer question 2 (if you have not already tried it) may be to make part of your app a `CBManagerCentralDelegate`, and then check results in `centralManager:didConnectPeripheral:` and `centralManager:didFailToConnectPeripheral:` . my thinking is that if the code that brings up the *Bluetooth Pairing Request* dialog then calls one of these when **Pair** or **Cancel** is chosen, you as the delegate will see the response. – john.k.doe Oct 05 '12 at 14:19
  • WrightsCS I am able to find Bluetooth hard ware but I am not getting this Alert thats why I am unable to write on hard ware. Please Help, how can I get this Alert. – Mangesh Jul 31 '13 at 11:20

2 Answers2

6
  • Question 1

No, I really dont think so. Clearing it through settings is the only possible way.

  • Question 2

The centralManager delegate has callbacks for both failed and successfully connected peripheral, so I would listen to them to check if user cancelled or not: didConnectPeripheral and didFailToConnectPeripheral

chwi
  • 2,663
  • 2
  • 34
  • 62
  • didConnectPeripheral fires with or without pressing "pair"... The didFailToConnectPeripheral does seem to work on cancel but the device is connected long before the alert dialog comes up. Connected and paired are not the same thing. – GoreDefex Jul 19 '17 at 15:27
  • 1
    Also, I guess things has changed from the initial release in 2012, being that the spec has changed dramatically :) – chwi Aug 03 '17 at 10:40
-1

When you click 'cancel' on the bonding dialog iOS will call the delegate method 'centralManagerDidUpdateState' with the state being 'CBCentralManagerResetting'. If you click pair then the command will proceed normally.

Sir Eisenhower
  • 241
  • 1
  • 2
  • 7
  • That is not right. At least not on iOS 9+. I don't know if it was that way in 2013 though – Jan Sep 22 '16 at 16:07