• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Running timers in background of BLE app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running timers in background of BLE app


  • Subject: Re: Running timers in background of BLE app
  • From: Ramin Firoozye <email@hidden>
  • Date: Thu, 09 Aug 2012 10:18:38 -0700

Title: Running timers in background of BLE app
I think what Michael is suggesting is using local notifications to set up a 15 minute timer. These are long-running timers delivered to the application just like push notifications. The app can be put in the background (or completely shut down). Once the timer expires you get the notification via the didReceiveLocalNotification method on the app delegate at which time you can scan for peripherals.

The only thing is that just like push notifications the user will be presented with an alert view telling them the timer has expired and they have the option of hitting 'cancel' and preventing the alarm from being delivered. However, if your UX workflow allows for this it's a good way to go.

Another method is if the app deals with sound, you can register it as an audio playback app and have it play a 1 second silent track in a loop. This allows the app to continue running actively even in the background and the watchdog timer will not kick it out. Obviously, it will affect battery life and may be rejected from the app store unless there's a legitimate reason for it to be playing audio in the background.

Best,
Ramin


On Aug 9, 2012, at 9:23 AM, Justin Shorney wrote:

We did some testing along these lines and a timer that runs for 15 min won't work in the background. You have to hook into the didDiscoverPeripheral at some point. Once this call is issued in the background you have aprox. 10seconds to do what you need to do before the watchdog gets you (or to register for a long running background task). That is unless another didDiscoverPeripheral gets called in which case you have another 10 seconds or so. If your iOS device is going to be in constant proximity of your Bluetooth object you could store the initial discovery time and check if 15min have passed on the subsequent discoveries.

Sent from my iPhone

On Aug 9, 2012, at 8:48 AM, Michael Kroll <email@hidden> wrote:

What about local notifications?

Regards,
Dr. Michael Kroll.
--------------------
Blog: http://www.mkroll.mobi
Forum: http://forum.mkroll.mobi

Sent from iPhone.

On 09.08.2012, at 17:29, Nick Moen <email@hidden> wrote:

Hi All,
I have an app that is currently scanning for BLE devices in the background. This part is working well, but I now need to trigger an event every 15 minutes or so. If the app subscribes to bluetooth-central, can Timers be run in the background? If not does anyone have any recommendations? Thanks in advance for any information.


Nick

Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Running timers in background of BLE app (From: Nick Moen <email@hidden>)
 >Re: Running timers in background of BLE app (From: Michael Kroll <email@hidden>)
 >Re: Running timers in background of BLE app (From: Justin Shorney <email@hidden>)

  • Prev by Date: Re: Running timers in background of BLE app
  • Next by Date: Broadcaster accessory role
  • Previous by thread: Re: Running timers in background of BLE app
  • Next by thread: RE: Running timers in background of BLE app
  • Index(es):
    • Date
    • Thread