I am developing an application for a custom wearable communicating through BLE.
I have subscribed to the UI background modes in the info.plist file for Bluetooth-central. I am transferring a firmware file of around 600 kb by dividing into chunk sizes of 200 bytes each. The process is going fine but as I am pressing the Home button the app is entering into background state and thus terminating the process after 1-2 minutes.
If my screens dims after certain amount of time then the firmware transfer continues but as soon as the home button is pressed the app stops transferring the data after few minutes.
Please help me out of this scenario.
Thanks.
To run task in background mode, you need to follow the belowed steps.
Step 1: Declare
__block UIBackgroundTaskIdentifier bgTask
as global variable.Step 2: To add following code in
applicationDidEnterBackground
.Step 3: Stop background task handler once apps come in foreground mode.