0
votes

I have an app that is keeping an active connection to a BLE device. The BLE device is sending data from time to time to the app, and I want the app to send this data to a server.

Note the app can be in foreground, background, the iPhone locked, or any possible state.

What I see is that if the app is in the background (after a while), when iOS awakes the app upon a new BLE update from my hardware device, the network request fails instantaneously (like it's not granting network access).

Does anybody know how to approach this issue? note that UIBackgroundTask doesn't seem to work as they can only be requested from the foreground (right?), and in my case, the app is already in the background when the BLE update hits the phone.

Any ideas?

1

1 Answers

0
votes

The approach I finally took is to use a background configured URLSession connection. Instead of making the app responsible to upload the data, with URLSession with a background mode, it will request OS to upload the data and notify the app once done.