Our BLE device is using ANCS and being connected as peripheral in the ios app. My problem happens in case when watch is being connected in settings screen first then it doesnt show up in scanned device thats why its not connecting while app is in background because its getting connected outside of the app, reason being iphone is bonded with ble device. Though I can retrieve it using retrievePeripheral function. But it has to be manually fired , I am looking for some kind of observer or delegate function which is called when a BLE device is called through system so I can retrieve peripheral. How to connect while app is in background and ble device is connected in Settings first? One solution I was thinking is run a timer which will call this retrievePeripheral function after a fixed interval, but that will be battery consuming. If anybody have better idea please enlighten me.
I have tried almost everything , I know scan function works in background with service ids but I am talking about the scenario where device is undiscoverable as it got connected in settings screen first.
Seems like I don't need to scan for device once its discovered, connected and successfully paired. In didDisconnect function I am retrieveing the ble device and sending a connect request See this, this function doesn't time out. Whenever BLE device will come into the range it will be connected.