Question

I am currently developping an Android application that can monitor the signal strength of an iBeacon with the library Android iBeacon Library (http://developer.radiusnetworks.com/ibeacon/android/).

But because we want to use iBeacons with very slow frequency to save battery, I need to be able to increase the frequency for a few minutes to have frequent detections during the signal strength monitoring. The problem is that the library I am using does not seem to provide this functionnality. I searched the web for other libraries that would offer this feature, but I can't find any.

Do you know a library that would let one change the beaconing frequency of an iBeacon? If not, how should I proceed to code it?

Was it helpful?

Solution

My revised understanding of your question is this: You want an Android library that communicates with an iBeacon to dynamically change its advertising rate.

Unfortunately, I think the Android side is the easy part. The hard part is that no iBeacon manufacturers I know of have an open API that allows you to dynamically change the advertising rate. (Although some do let you use an app to configure this rate over a secondary Bluetooth connection. Radius Networks' small USB-powered iBeacons work this way.) Because each vendor's service works differently, you'd have to reverse-engineer how each of their configuration BLE services works.

If you really want to do this, here is how I would approach it:

  1. Build your own custom iBeacon that has a secondary Bluetooth LE service that allows you to connect to the beacon and change its advertising rate. A great way to prototype this would be with an iOS device acting as an iBeacon or with one of my company's iBeacon Development Kits. For an iOS-based beacon, you can write the secondary service in Objective C. For the IDK beacon, you can write the software in any language supported by Linux.

  2. Write custom Android code that connects to the bluetooth service and sets the advertising rate as needed. You could use this alongside the Android iBeacon Library. And as an open-source project, you could always offer to merge your code into it once you have it working. (I'm the guy to talk to!)

  3. Once you have this working, talk to an iBeacon vendor to make custom firmware for a battery-powered beacon that does the exact same thing. Hardware suppliers will tell you how to make custom firmware. This typically requires a proprietary workbench tool and is done in C or in a proprietary scripting language.

OTHER TIPS

Yes! The Android iBeacon Library from Radius Networks Supports this. Below is sample code that changes both the foreground and background scan period to be every 5 minutes. What this means is that the library will spend five minutes doing scanning, and let you know what iBeacons it sees during that time. (The foreground default is 1.1 seconds.)

You can change this frequency as you wish based on some algorithm in your app.

iBeaconManager = IBeaconManager.getInstanceForApplication(this.getApplicationContext());

...

@Override
public void onIBeaconServiceConnect() {
    try {
      long five_minutes_in_millis = 5*60*1000l;
      iBeaconManager.setForegroundScanPeriod(five_minutes_in_millis); 
      iBeaconManager.setBackgroundScanPeriod(five_minutes_in_millis); 
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

Full disclosure: I am an employee of Radius Networks and the primary author of this library.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top