I would be really happy if my application could detect beacons when app is killed not even in background. It working fine when it is in background with one of this solution (Ranging beacons in background - is that possible?). Can any one help me with this (@r00dY)
One solution would be to use monitoring to have your app relaunched if it’s killed and a beacon event (enter/exit) comes. And then, once your app gets relaunched into the background, you could range for a few seconds (no special work required), for up to 3 minutes (starting a background execution task required), or indefinitely (starting regular location updates required—you need a really good reason for that though, otherwise you’ll have your app rejected from the App Store!).
What app are you building? Why does it need to constantly range even if the user is not using it? Keep in mind this will drain the phone’s battery, as constant ranging is not as energy efficient as simple enter/exit monitoring.
Thanks @heypiotr actually i want to generate map according to detected beacons even if i dont open app it will hit beacons and give me the result that how much time i have spent to particular place
You should actually be able to do that with just monitoring, e.g.:
- I enter the range of the “kitchen” beacon.
- The app wakes up in the background with the “didEnter” event, saves the current time to the disk.
- I leave the range of the “kitchen” beacon.
- The app wakes up in the background with the “didExit” event, compares current time to the previous time; the difference = how much time I spent in the kitchen.