3

I'm currently trying to develop a Bluetooth IOS application that can work in background. I methodically followed the tuts on the IOS developper website, and it works pretty fine; I'm getting stuck whenever I want to update a subscribed characteristic in background.

When my Peripheral device enters in background, I want the characteristic to periodically update, so that it send a notification to the Central device, taking advantage of the characteristic subscription mode. Note : for now the characteristic is only a timestamp, updated every 5 seconds, in order to test if it works well

First I implemented a NSTimer, but as expected it is killed when the Peripheral app enters in background. Then I tried to establish a Background Fetch mode, but it is only possible to set a minimum refresh interval (and not warming up my application on fixed period).

Does somebody have an idea on how to proceed/overcome the problem?

Thank you!

Ps: I appologize for my English, I'm a bit rusty

Paolo Maresca
  • 7,396
  • 4
  • 34
  • 30
Olympiloutre
  • 2,268
  • 3
  • 28
  • 38
  • You should be able to achieve this by subscribing to the characteristic and implementing bluetooth backgrounding and state restoration: http://stackoverflow.com/a/33137848/22147 – Rhythmic Fistman Oct 20 '15 at 02:18
  • When I read the corresponding part on the apple developper website, I understood that State restoration is only helpfull to wake up a Peripheral after a long inactivity period. In this case I want to periodically update the Peripheral characteristic withoud any loss of signal between the two devices. Maybe I could call the update function in another background mode? Such as Background location update ? For instance when the user moves, it update the timestamp characteristic, which is automatically sent to the Central ? – Olympiloutre Oct 20 '15 at 12:05

0 Answers0