Identify when user reach CLProximityImmediate in background

I have done an iOS project, which is triggering local notification whenever user come near a beacon, which we configured in

I used startMonitoringForRegion method, and the app is calling didEnterRegion properly, even when the app is in background.

Now, we are going to change the way user getting local notification. The notification have to get triggered only when the user reaches very nearby ie) CLProximityImmediate

And i also want it to work in background, and even when the app is not running in background as well.

I studied about startRangingBeaconsInRegion method. But i've heard that it will not work in background/app not running mode.

After didEnterRegion delegate method did call, i have plan to call startRangingBeaconsInRegion and wait for device to come to CLProximityImmediate. Is it the proper way to do this? Will startRangingBeaconsInRegion keep ranging for beacons in background mode till user reaches CLProximityImmediate?

How can i achieve this?
Can you please guide me?

Thank you.

Or changing just the range of the beacon from 73m to a a fewer inch will work?

Please advice, Thank you.

Yup, I'd start with changing the broadcasting power of the beacon to the minimum value.

Note that when didEnterRegion wakes the app, by default it only gets about 10 seconds of background execution time. In iOS 8, you can extend this up to 3 minutes by starting a background task. Then you ranging + check for CLProximityImmediate should work just fine.

When i set power to maximum value, i will get didEnterRegion called when user is in the range of about 73m. If i change the power to very minimum value, when will i get didEnterRegion method called? around 10m or something like that?

It should be around 3 meters.

One more question.

I have done an iOS project.
It will start monitoring my 3 real beacons(mint, blueberry and ice) and a Virtual beacon in didFinishLaunchingWithOptions application delegate method.
Whenever i come into region of Virtual beacon, it is calling didEnterRegion and Whenever i go out of region of Virtual beacon, it is calling didExitRegion properly.

In case of real beacon, didEnterRegion/didExitRegion are getting called properly, But sometime, even i am not going out of region of mint beacon, i am getting didExitRegion method. And sometimes later, i am getting didEnterRegion automatically without i am moving both my iPhone or mint beacon.

I have heard that i have to adjust "Advertising Interval" to make it not happening.
Adjusting "Advertising Interval" will work for fixing this issue?
If yes, what "Advertising Interval" do you recommend for this issue not to happen?

Please advice,
Thank you.


In general, the closer you are to a beacon the more accurate the reported distance — likewise, the further away the beacon is to a mobile device, the less accurate the distance reading. This is due to the emitted signal being strongest or most pronounced at close proximity and weakest at the edge of the beacon's maximum range.

It is possible to increase the signal's reliability by increasing the broadcasting power and the advertising interval of a beacon. For scenarios including precise user location, like indoor mapping, high power and low interval are required to provide quality services. Keep in mind, however, that it will have an impact on the battery life.

Thank you so much for your answer.

You're welcome Paramasivan. If you have more questions please ask.

Im sorry, but was it answered whether or not you can run a function continuously after entering the range?

iOS applications in general can’t run at all when not in the foreground—they go to sleep soon after you navigate away from the app. There’s very few exceptions to this (e.g., if you’re a music app), and even iBeacon apps can only be woken up for a few seconds when entering/exiting range of beacons.

There’s a few tricks that might interest you being discussed in this thread: