6

I'm looking at implementing a beacon based app to do some location tracking based on beacon placement. From what I've read and understood, beacon monitoring is fairly innocuous on battery life but ranging definitely takes a bigger hit on battery life.

Are there any specs or tricks/techniques to minimize battery consumption when ranging? How does battery life when ranging compare to GPS location tracking?

Eric B.
  • 23,425
  • 50
  • 169
  • 316

2 Answers2

7

Beacon ranging uses much less battery than GPS tracking, because it powers up the Bluetooth Low Energy radio receiver vs. the GPS receiver. Although, I don't have specific numbers, the GPS receiver is much more power hungry.

The difference in power consumption between Ranging and Monitoring is a bit muddy and is different between iOS and Android. On iOS, ranging is only allowed in the foreground unless you have a special background permission (which you can only get if you have a navigation app). When done in the foreground, ranging uses much less power than the screen, so it is insignificant.

Constant ranging in the background (possible on Android and on iOS with special permission) will drain the battery at a rate similar to cellular standby. In other words, expect that the battery of a phone that is ranging will drain twice as fast as a phone that is just sitting idle with its screen off but its cellular radio on.

An important caveat is that just because you enable ranging for an app and move it to the background, doesn't mean it will range constantly. As mentioned, iOS will normally shut down ranging five seconds after the app leaves the foreground. Similarly, Android devices using the Android Beacon Library will throttle background ranging to only happen 10 seconds out of every five minutes. On Android you must specifically configure it to do otherwise, and on iOS you must provide special permission.

What special tricks can you do to minimize battery consumption when ranging? Don't do it constantly. Accept the defaults above or throttle ranging manually so you only range 10% of the time or less.

Monitoring in the background uses less power than constant ranging because it doesn't do an active scan all the time. iPhone 5+ and Android 5+ devices use hardware assist in the bluetooth chip to trigger off of beacon patterns without doing an active scan. iPhone 4S and Android 4.x devices throttle the scanning automatically to keep battery usage low.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • Is there an Apple definition of a "navigation app"? For instance, if I want to use the app to track a user's path through a shopping mall or a department store, would that be considered navigation? And use the app to provide directional information (ie: turn right to go to Target, Walmart, left to go to Home Depot, etc)? Monitoring is great, but from my understanding will only trigger when you enter/exit a region. But not transverse beacons within the region (ie: if the region is defined only by UUID, then as you cross different major/minors there won't be a trigger). – Eric B. Mar 22 '15 at 01:06
  • Welcome to the opaque world of the AppStore review process! I would think the use case you describe would qualify, but I don't work for Apple, and I am often surprised by what gets rejected. – davidgyoung Mar 22 '15 at 01:42
  • 1
    *laugh* The problem, of course, is to build your app expecting for it to qualify, only for it to fail and then blow your entire business case out the window if your app cannot do what you intended it to do. – Eric B. Mar 22 '15 at 01:47
0

Are there any specs or tricks/techniques to minimize battery consumption when ranging? How does battery life when ranging compare to GPS location tracking?

I have not worked in iOS part but will share my 2 cents on Android.

For Android, you can use BackgroundPowerSaver.Just instantiate it. Something like -

...
import org.altbeacon.beacon.powersave.BackgroundPowerSaver;

public class MyApplication extends Application {
    private BackgroundPowerSaver backgroundPowerSaver;

    public void onCreate() {
        super.onCreate();
        backgroundPowerSaver = new BackgroundPowerSaver(this);
    }
}

Source : https://altbeacon.github.io/android-beacon-library/battery_manager.html

Behind the scenes values used are -

public static final long DEFAULT_FOREGROUND_SCAN_PERIOD = 1100;
public static final long DEFAULT_FOREGROUND_BETWEEN_SCAN_PERIOD = 0;
public static final long DEFAULT_BACKGROUND_SCAN_PERIOD = 10000;
public static final long DEFAULT_BACKGROUND_BETWEEN_SCAN_PERIOD = 5 * 60 * 1000;

So for the app in foreground scan is run for 1.1 seconds in the loop whereas for the background it is run for 10 seconds every 5 mins.

If you do not want these defaults you can set your custom scan times as well in BeaconManager.

Source : https://github.com/AltBeacon/android-beacon-library/blob/master/src/main/java/org/altbeacon/beacon/BeaconManager.java

However based on what I'm seeing location tracking takes much more battery than the BLE scans. So keep you location updates to as minimum as needed and rely on last know location unless you want very real-time data. Discussed in detail - https://developer.android.com/guide/topics/location/strategies.html

Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289