Restoring Microsoft Band connectivity on iOS - ios

I am working with the Microsoft Band SDK on iOS and I have a question on restoring connectivity in the background when using the Band SDK. With the Band SDK you connect via Microsoft's API rather than directly to the bluetooth device using Bluetooth Core on iOS. This gets you several events including device connected, device disconnected, etc.
The problem I am having is how to restore a connection if the device disconnects, such as going out of range. I would like to be able to restore the connection when my app is in the background without having to bring the app back to the foreground. I have added the bluetooth background modes to my Info.plist, which allows me to process events from the device in the background but any attempt I make from the background to restore the connection never seems to complete until I bring the app to the foreground.
All the documentation on state preservation with Core Bluetooth seems to only apply if I am managing the device myself using the CBCentralManager, however since I am using Microsoft's Band SDK as an intermediary I don't believe I can use this.
So any help on how I can restore the connection via the Band SDK API while my app is in the background would be appreciated. I know the correct API calls to make I'm just unsure how/if they can succeed while my app is in the background.

Direct access to the Band via Core Bluetooth is not supported for 3rd party apps. So, managing the Band from CBCentralManager will not be possible from your app.

Related

How to save a bluetooth connection to settings using CoreBluetooth and Swift

I have a device I want to keep connected to my iPhone while the app I'm building is not running. Currently, I'm at the point where I connect to the bluetooth device, hop over to settings, and can see the device there (I'm using the Nordic Thingy for testing).
I know it is possible because I have a Bose app that does the same thing with my headphones: it doesn't need me to have the app open or even in the background for the headphones to work after I've connected to them via the app.
I've looked into how to persist the bluetooth connections with my team, but we've only found guides similar to this one on how to save data in the background for autoconnection when the app is open again, or guides on how to work with bluetooth devices when your app is in the background.
Is there a way to mimic Bose's behavior here?

IoT device that use iPhone as Gateway

I'm developing an IoT device that will connect to iOS via Bluetooth.
I've seen some smartwatches that uses the iPhone as a gateway to perform Internet connection tasks like getting weather data, without the need to open a particular app.
How can this be achieved?
Is there any supported Bluetooth Profile that iOS support for that functionality?
There is a way to allow you to listen to Bluetooth activities in the background as well. Check out this documentation.
And, for the part about running tasks without the app running in the foreground, you might want to check out the background execution API (Only in iOS 13)

Connect to a backgrounded iOS app acting as a peripheral from a macOS app

I have an iOS and macOS app that make heavy use of Core Bluetooth. The core functionality of the app involves having a central device (CBCentralManager) connect to a peripheral device (CBPeripheralManager), retrieve some data, then disconnect. Either device, whether macOS or iOS can act as either a central or peripheral depending on who needs the data.
At first I thought there was an issue with my code, but after testing the app with two iOS devices, one is able to connect and extract data from the peripheral device even when the peripheral device is locked and the app is in the background. Now according to the docs concerning background advertising on iOS under "The bluetooth-peripheral Background Execution Mode" this is kind of expected:
...they can be discovered only by an iOS device that is explicitly scanning for them.
Is there any way to have a macOS app discover peripherals even when they're backgrounded? I'm sure the code I've written is correct because it's the same across iOS and macOS.
Update 1
I believe that this might be possible just unsure how to approach the issue. Using Apple's Bluetooth Explorer on macOS, I am able to find the desired device AND I'm able to see and read data for my custom service.
This finding is validated from logs from my iOS device about the read requests which are from my peripheralManager(CBPeripheralManager, didReceiveRead: CBATTRequest).

Ios Application connected in Background with device

i have an application that is connected with a chip by bluetooth.
Device and phone are constantly connected to calculate the distance between them by bluetooth delay in reply.
App is working fine in foreground.
When i go background the app is still running, but cannot connect to the device.
I already tried to fix with this guide: Core Bluetooth Programming Guide
but i didnt made it.
Some suggestion?
You need to introduce more detail.
Your app will not run in background mode even bluetooth connection is on.
But your app still have a chance to execute some code in a short time if some bluetooth event happen.
Connection lost.
Notification received.
If your application work like anti-loss bluetooth tag, you need
Enable background in iOS app.
Write your code in core bluetooth delegate.
And One reminder: Calculate distance based on bluetooth relay is not smart. Bluetooth communication is not designed to support this kind of feature.
It work on license free 2.4G band and human body has big impact on it.

How to communicate and track the external bluetooth device state to iOS 8.4 application?

I am working on VOIP application. I am using Xcode 6.4 with iOS 8.4 SDK.
My requirement is once call established in my application, i need to track whether external bluetooth is connected or not with my iPhone device as well as with my app. I need to communicate with external bluetooth device via my application in call active state. Like how native call and whats app doing in iOS. Same functionality im implementing. Also I need to track if bluetooth device terminated while call is active state in application.
I have tried somany ways by using Corebluetooth frame work. but, Only centralManagerDidUpdateState delegate method calling after that didDiscoverPeripheral not calling. I am unable to track the external device either turn off or turn on, but i am able to connecting after paired manually in settings. Could anyone suggest me a solution?

Resources