6

I'm creating a watchOS application. The app should connect to a BLE tag, which sends distance values to the apple watch. If the distance falls below a given value, the application should give some feedback to the user about this.

Reading about core bluetooth and background tasks, it doesn't seems like it's possible. If I'm correct, when the application is suspended, it will no longer receive data from the BLE peripheral. How should I approach this task? Is it possible to run an application like this for 8 hours in the background? I can't find any more information about this, and it seems like it's impossible.

adamb
  • 793
  • 1
  • 11
  • 20

1 Answers1

5

There are restrictions to WatchOS apps using Bluetooth in the background, the main being:-

  • The minimum connection interval is 30ms instead of 15ms (for iOS devices).
  • The Apple watch can only operate as a central device.
  • The Apple watch can only be connected to two peripherals at one time.
  • The peripheral gets disconnected when the app goes into the background.

More details about this can be found in the following links:-

The only exception to this is if you use the HKWorkoutSession. More information about this can be found here.

I hope this helps.

enter image description here

Youssif Saeed
  • 11,789
  • 4
  • 44
  • 72
  • Are these restrictions still in place for WatchOS 8? – Daniel T. Jul 12 '21 at 15:28
  • in WatchOS 8 I am not able to get notification or write to BLE device while in background during Workout session. this seems to be a changed behaviour compared to watchOS 7. The common suggestion is to use 'Bluetooth-central' In plist UIBackground-modes - but I am not able to upload an app to testFlight with this flag on, as it has some entitlement signing issue. – benchuk Jan 18 '22 at 00:18
  • There do seem to be issues (or at least more restrictions) in WatchOS 8 when it comes to background operation. I have seen this post where a user was able to recreate the problem using Apple's own demo application (https://developer.apple.com/forums/thread/692685) I am not aware if there's a proper solution for this. – Youssif Saeed Jan 18 '22 at 07:09