I am working on a Flutter application which is use solely to collect data from a bluetooth low energy (BLE) peripheral and then upload the data to our cloud.
The application runs in the background 99% of the time after the initial login and BLE pairing which is causing us some issues.
After the Application is backgrounded it would work for a day to 2 days and then stop working. (What I mean with working is to download data from the BLE peripheral and then upload the data to our cloud). Once the data syncing has stopped it would take up to 12 hours until data starts flowing again.
I have read in a couple of places that iOS implements some sort of "budget/heuristics" when the application is running in the background to keep track of the application and when this "budget" is used up iOS will stop servicing the application until iOS decides that the application can run in the background again.
My question, is it possible via a enablement or some other mechanism to prevent iOS from blocking our application from running in the background to enable 24/7 periodic data uploads every 30 minutes.
We have implemented the following so far;
- The data sync process is triggered from the BLE peripheral using a notification. This notification is sent every 30 minutes.
- Each sync duration is currently 24 seconds on average, we are working on reducing this to below 10 seconds.
- We implemented State Restoration to assist iOS in starting the application more efficiently.
- We are considering using Silent Push Notifications from the Cloud to wake up the application when data hasn't synced in 6 hours.
Any assistance would be high appreciated.