Beacon inconsistency with app

Hello!


I am designing an iBeacon device to work with an app on an iPhone. The issue is a very strange inconsistency with the app recognising the beacons. I have learned about beacons mostly from this document: https://developer.apple.com/ibeacon/Getting-Started-with-iBeacon.pdf

Here is a short introduction to my system:


The Device:

- A button press on the device triggers iBeacon BLE advertisements at 10Hz for about two seconds.

- The device cycles through 20 UUID's, in order, to use for each different button press. This is to differentiate between button presses in the event of rapid button pressing, when the app doesn't have time to "get out of range". 20 UUID's being the limit imposed by Apple that an app is allowed to monitor for.


The App:

- The app searches for any of the 20 UUID's.

- Upon detection, enter and exit events trigger some app events, and ranging is briefly used in its breif allotted background time to extract Maj. Min. pair values.


The Testing:

For testing, the app is set up to display a popup when enter, range, and exit events occur. Testing occurs with the app in the foreground. I press the button, watch for enter and range events, and wait until it exits the region before pressing again. Testing with a BLE scanner shows that the device works well and is broadcasting 100% for a button press, cycling through the 20 UUID's correctly.


The Problem:

In app testing, the problem appears, and follows a strange pattern. The app recognises the first 9 or so button presses/UUID's well. After that, usually on the 10th button press, the app stops responding to the beacons. no popups. On my BLE scanner i can clearly see that the device was properly broadcasting. The device usually starts recognising the beacons again when the device has cycled back to the first UUID. I say 'usually' because it sometimes stops at the 11th UUID, and sometimes starts again on the 20th UUID, and once I even randomly saw the 12th UUID, but there is usually this gap or 'dead zone' for the second half of the UUID's. I CAN get it to work if I mash the button quickly. The popups will come in quickly, and show the UUID's cycling all they way through 20, so i know the UUID's are good, and the app IS capable. The problem exists when time between button presses is more than a minute or so.

Another strange thing I can do is mash the button, successfully seeing the app popups, and then stop when i'm in the UUID 'dead zone' range of 10-20, say at UUID 14 in the list. If I wait for a minute and press again, it won't work until I reach the the first UUID again, after 7 button presses.

Other notes:

- I dont always see the region exit popup, sometimes they exit really quickly, sometimes it takes longer.

- The pattern is not strictly consistent. It varies sometimes. Sometimes it will work for a full cycle, but it usually falls into this gap pattern.

- I am testing on two phones on iOS 11 and 10.


Ideas:

It is strange that it almost always wants to start working again at the first UUID. So this makes me think its not an absolute timing issue, otherwise the gap would exist in time, and not in the UUID list.

It is strange that it works when quickly being cycled.


Is Apple blacklisting the other UID after 10 because it thinks i'm spamming UUID's, or scanning for too many too quickly?

Is it a deeper iOS BLE caching issue i don't know about?

Is it a timing issue with some kind of iOS BLE background scan scheduler thing?

Does this just sound like a bug in the app code?


Thanks for any help or ideas!

It seems to be solved!



The issue was another old test app on the same Developer/Test Flight account that was interfering with the newer app. I speculate it was registering beacon regions that were stealing from the 20 region limit imposed by apple per app.



My new quetion is, what then defines an app with regards to this 20 region limit? Why did this totally sepreate app, albeit on the same Developer account and Test Flight account, interfere with the CoreLocation region limit? Will other 3rd party apps that want to scan for beacons also interfere with my app by stealing some of the 20 regions? The documentation states "Core Location limits to 20 the number of regions that may be simultaneously monitored by a single app". I want to trust this, but then why did the other app still interfere with another apps 20 limit?



Thank you for your help!

Beacon inconsistency with app
 
 
Q