I have a weighing scale from Acaia(Peripheral) that emits weight data at 5 points/sec. I used Acaias iOS SDK to make an app that can connect to it to receive the data points.
I want to make the connection alive even in the background state so I have enabled the Background State mode in Capabilities for Bluetooth. Now the App keeps receiving data using NSNotifications.
Requirement and my work
I have to push this data to our servers for that I am storing the Data in an array and at every 10 seconds, I am making an API POST call to push the content available in array to our servers, and then I am resetting the array.
I have read Apple developer guide which says its possible to keep the connection alive with a Peripheral device permanently in background if data points keep coming. Now how do I ensure that I don't lose those weights data? Is it possible to push all these in the server, maybe in Batch API Call?
Ref:
Background processing is possible in IOS. But it should do only the work for which it is held on in background state from suspended state. Also, what i have found is that BLE peripheral devices that constantly keep pushing data to IOS apps prevent app from getting in suspended state, And thus its possible for app to be in background forever, Unless IOS tries to kill it for memory and other issues.