Multiple Regions in the Demo Application

Hi. We are working on an android app that uses estimote beacons and are having trouble creating multiple regions. We tested our code by placing three beacons near the android device with our app installed. We defined three region variables, region, region2 and region3. In our onEnteredRegion method we used three if statements with conditions that if the major and minor values of each region equal the corresponding major and minor values of a specific beacon, a notification will appear. However, everytime we run the app we only get one out of the three unique messages. Somehow the onEnteredRegion method is not working for multiple regions. Is it possible to define multiple regions in code and post a unique notification depending on the region? Or do we have to use another method or function to incorporate multiple beacons in the demo application provided on Github? Thanks!

Can you share the code where you define the regions and start monitoring? Do you use unique identifiers for each region? It’s 100% possible to range/monitor multiple regions at the same time, so it’s likely some small problem with your code, we’ll be happy to help with that.

public class NotifyDemoActivity extends BaseActivity {

private static final int NOTIFICATION_ID = 123;

private BeaconManager beaconManager;
private NotificationManager notificationManager;
private Region region;
//private Region region2;
//private Region region3;

private UUID uuid = UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D");

@Override protected int getLayoutResId() {
  return R.layout.notify_demo;

protected void onCreate(Bundle savedInstanceState) {

//Beacon beacon = getIntent().getParcelableExtra(ListBeaconsActivity.EXTRAS_BEACON);
region = new Region("regionId1", uuid, 28280, 55537);
region = new Region("regionId2", uuid, 29632, 4951);
region = new Region("regionId3", uuid, 28233, 13329);

notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
beaconManager = new BeaconManager(this);

beaconManager.setBackgroundScanPeriod(TimeUnit.SECONDS.toMillis(1), TimeUnit.SECONDS.toMillis(0));


beaconManager.setMonitoringListener(new MonitoringListener() {

  public void onEnteredRegion(Region region, List<Beacon> beacons) {

    if (region.getIdentifier().equals("regionId1")) {

      postNotification("Entered meeting room");
    else if (region.getIdentifier().equals("regionId2")) {

      postNotification("Entered bathroom");

    else if (region.getIdentifier().equals("regionId3")) {

      postNotification("Entered movie theater");


  public void onExitedRegion(Region region) {
    postNotification("Exited region");


protected void onResume() {

beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
  public void onServiceReady() {
//        beaconManager.startMonitoring(region2);
//        beaconManager.startMonitoring(region3);

protected void onDestroy() {

 private void postNotification(String msg) {
   Intent notifyIntent = new Intent(NotifyDemoActivity.this, NotifyDemoActivity.class);
   PendingIntent pendingIntent = PendingIntent.getActivities(
       new Intent[]{notifyIntent},
   Notification notification = new Notification.Builder(NotifyDemoActivity.this)
       .setContentTitle("Notify Demo")
     notification.defaults |= Notification.DEFAULT_SOUND;
     notification.defaults |= Notification.DEFAULT_LIGHTS;
     notificationManager.notify(NOTIFICATION_ID, notification);

   TextView statusTextView = (TextView) findViewById(;

We got this code from the Estimote Demos application from Github. We are trying to modify the notification aspect of this application to incorporate multiple beacons…

Hmm, does this code work for you? You have beaconManager.startMonitoring(region); before beaconManager = new BeaconManager(this);, so to my eye, it should be throwing null pointer exceptions?