1
votes

I'm developing a BLE enabled App. In my App iPhone operate in peripheral mode with Bluetooth accessories. Everything works fine until I go to background Mode Because my Phone is working as peripheral so It also update accessory with battery level it doesn't work in background because app will only wakeup once accessory will send request because its already subscribe for the update I somehow have to wakeup my app in background mode and send update let's say every x minutes . I have already enable Bluetooth LE accessory background mode.

2
It would probably be better to implement ANCS in your devicePaulw11
@Paulw11 can we get the notification of the alert that iOS display when iPhone battery is less then 20 using ANCS ? Thank youImran

2 Answers

0
votes

Apparently enabling background mode only gives the 'right' to run in the background whenever there is an event triggered.

One of the method is what you already did by 'polling' from the accessories periodically by sending request to wake up the app and execute the task.

Another way is to use background refresh. The only downside of background refresh is the event will not occur at specific period. It was mentioned at about 10-15mins typically or it might tag along with other app background wake up. If the update is not very frequent or crucial, this method would probably better for your case.

0
votes

You can keep your app running in background by setting the "required background modes" option in your plist. Select "App communicate with accessory".

Please see the attached image for referenceenter image description here