M
M
Michael P.2019-08-21 12:37:48
iOS
Michael P., 2019-08-21 12:37:48

How to improve the reliability of the BLE scanner in the background in iOS?

Hello!
We are developing an application that in the background (background) should determine the position of the phone in the premises, based on the BLE iBeacon. Every 30 seconds we run the scanner for 10 seconds to get the RSSI data of our beacons (the UUID is static for all beacons, we filter by it, Major and Minor are unique for each beacon). Then we filter the RSSI values ​​and get the closest beacon to the user. Beacon transmission frequency = 1Hz.
We can’t achieve reliable operation of the service in the background, it either stops working, then starts again.
Flow description:

  • collect beacons from the method
    locationManager(_ manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion)

  • there we launch the background taskUIApplication.shared.beginBackgroundTask
  • and immediately start the default timerTimer() for 10 seconds
  • after 10 seconds, do the calculations, find the nearest beacon
  • send native request to the server data
  • close the background task in the callback of the request

How do the variables of the service used in the calculations behave in the background?
How to set up a background for stable work on a timer? Does it make sense to reduce the scan time (10 seconds background) or\and increase the beacon broadcast frequency (1Hz)
ps
settings in plistand settings in the application responsible for working in the background have been added. User allows Always use location

Answer the question

In order to leave comments, you need to log in

3 answer(s)
B
briahas, 2019-08-21
@briahas

I suspect that in your project settings it is written that the task background is needed for the location track.
And the system, in this case, decides when to launch your process for the location track. Because she is smarter.

D
doublench21, 2019-08-21
@doublench21

Every time the same thing. Lastly, remember:
- The state when your application is in a disabled state , you can do absolutely NOTHING .
- The state when your application is in a minimized state , you can only do a very small number of actions with even less time allotted for this task. Time in this case is absolutely uncontrollable. The system itself decides when and what to run in this state.
Therefore, this kind of application that tries to do something in a minimized state in the desired IM cannot and will not exist.
Which I completely agree with Apple. Who needs an application that, on a whim, will do in the background what it wants and, most importantly, when it wants. If I closed it or turned it off, then it is not interesting to me.

A
Anton Filippov, 2018-01-26
@DeniSidorenko

use the same method only without passing value to it, and applying not to window, but to the desired element
The documentation describes in detail https://api.jquery.com/scrollTop/ (the first case, and you, apparently, about the second)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question