1

all day I tested the monitoring of beacons my app does. in general it works ok:

  • notifications in foreground work
  • notifications in background work

BUT

after a reboot it doesn't work until I launch ANY app that uses BluetoothLE

after I do that it works fine for my app as well!


But if I set UIBackgroundMode location in my plist though, my app gets region notifications just fine even after a reboot.

So... is that it? or whats the deal here? :D this is under ios 7.1.1 btw

The code is very minimal: https://github.com/RadiusNetworks/ibeacon-background-demo/blob/master/BackgroundDemo/BDAppDelegate.m

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
  • What happens if you take out UIBackgroundMode location, reboot and wait an hour? Do you ever get a detection? I suspect a timing issue. – davidgyoung May 17 '14 at 13:50
  • well.. I waited 'only' 45 minutes but that's as good as never ^^ and AS SOON as I click on any app that uses BLE, it works instantly – Daij-Djan May 17 '14 at 14:04
  • it seems that the services need a initial signal from somewhere? – Daij-Djan May 17 '14 at 14:05
  • I admit that it is Mysterious but I spent days trying this and it is always the same :D .. Ill try it overnight today but that won't help me anyways – Daij-Djan May 17 '14 at 14:06
  • When you say an app that uses BLE, you mean an app that uses BLE in the *foreground* right? Yes, it is absolutely correct that if one app triggers a bluetooth scan, other apps in the background get the benefit. My earlier testing with an iPhone 4S (with 7.0.x and 7.1) did not require the 'initial signal' after reboot you describe, but I have not tested with 7.1.1. – davidgyoung May 17 '14 at 18:19
  • @davidgyoung btw thank you :) -- right ble in foreground as initial trigger – Daij-Djan May 17 '14 at 21:46

1 Answers1

0

I did two things:

First, I reduced the time it took the app to launch >> mainly by doing stuff only when the app moves to the foreground. That was Step 1 but for the real app I was working on that alone was only half the solution

I then found out that the application in question tried to access the keychain in the background while the device was locked I moved that to a later point too and BING it worked!

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135