iBeacon background scanning

I've written my own little BLE scanning service that is triggered via an alarm every 3-5 seconds. It scans for 1.1 seconds to get teh beacons around it and then transforms the RSSI signal into a rough proximity.

I am now considering the Radius Networks Android iBeacon service, but I am wondering how I could realize the same background scanning.

e.g.: I want the beacons scannign to start annd run in the background and receive Intents into a broadcast receiver to decide what I do with the beacons scanned.

Are there soem examples and is there an estimate how much battery this consumes?


Radius Networks' Android iBeacon Library does exactly that. All you have to do to run it in the background is bind the IBeaconManager to something with a long lifecycle. This can be a custom android.app.Application object, or a Service of your own. Since you have already written your own service for your app, you could easily bind the IBeaconManager to that service, and it would remain active in the background as long as the service runs. You could also use your service to send out broadcast intents if you wish, but for most use cases this is probably not necessary.

As for battery usage, the library's reference application has an example of how to set the background mode on the library so scans happen less often, saving battery. The pertinent code in that reference app is here:

    protected void onPause() {
            if (iBeaconManager.isBound(this)) iBeaconManager.setBackgroundMode(this, true);                    
    protected void onResume() {
            if (iBeaconManager.isBound(this)) iBeaconManager.setBackgroundMode(this, false);                    

Setting the background mode to true reduces the Bluetooth scans to happen only once very 5 minutes -- something similar to what iOS does. Based on tests on a Nexus 4, this reduces the phone's overall battery consumption from 95mA to 55mA (both of which numbers include the overall operating system drain.)

Full Disclosure: I work for Radius Networks and am the primary author of the Android iBeaconLibrary.

Need Your Help

Property 'submit' of object #<HTMLFormElement> is not a function

javascript jquery html forms submit

Can anyone explain to me what this error means? I would appreciate it a lot for any kindof help with this.

Best way to draw icons on a pie (or circular) menu?

user-interface menu graph circular

I am trying to figure out an algorithm to calculate where to place any number of icons for a circular menu on a device with a screen that is 240x320. The icons are 48x48 but can be scaled to any si...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.