1

I am connecting an external bluetooth peripheral to iPhone 5S(iOS 10.0.1). Peripheral sends data at every 2 seconds.

After 4 minutes(approx), peripheral goes idle & app will not receiving data from peripheral.

When I put app in background when peripheral goes idle, then upto 3 minutes (approx) app can upload/fetch data.

But I want to upload data after 25 minutes, & app is not working with 'NSTimer' or 'performSelector:afterdelay' after 3 minutes.

Can anyone have better suggestion?

Thank you in advance.

  • If you enable "uses Bluetooth peripherals" background mode then your app will receive notifications from the peripheral in the background, but there is no way to initiate a transmission from your app in the background after a specified period of time. iOS background execution doesn't work like that. – Paulw11 Apr 13 '17 at 13:25
  • What is the 'specified period of time'? Have Apple provided such docs? – Minhaz Panara Apr 14 '17 at 04:46
  • I mean that there is no way to initiate sending of data after **any** period of time when your app in the background. Time-based "wake up" is not supported for iOS apps. With CoreBluetooth background mode your app can respond to peripheral discovery, peripheral connection/disconnection and a notification from the peripheral. Refer to the Core Bluetooth programming guide from Apple – Paulw11 Apr 14 '17 at 05:48
  • Thank you for reply, Paulw. I have also noticed by logging in background mode using 'NSTimer'. The app will be alive in background upto 3 minutes. I also observe, "External peripheral connection keeps application alive for a long time until it sends data", is that correct? – Minhaz Panara Apr 14 '17 at 10:33
  • your solution is here: http://stackoverflow.com/questions/35313020/count-while-in-background-nstimer-for-more-than-3-mins/35314268#35314268 – mylittleswift May 09 '17 at 04:20
  • @mylittleswift the solution will work only when you are using location services for a purpose in your app otherwise Apple stands to reject your app. – Minhaz Panara Nov 14 '19 at 10:00

0 Answers0