I am modifying the Demo App provided by Estimote. At the moment I am receiving a notification when I enter in the region of a beacon and then I won't receive any more notification unless I exit that region. I would like instead to receive a notification each time the closest beacon is changed. That is if the closest beacon is the green then I would like to receive a notification, but if after 2 seconds the closest beacon is the blue one I would like to get another notification. Then I will filter the notification in some way..
I have a class called NotifyApp which extends an Application. I don't undersant if I have to use different MonitoringListener methods, one for each region or instead should I use the RangingListener..
public void onCreate() {
super.onCreate();
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
beaconManager = new BeaconManager(this);
beaconManager.setBackgroundScanPeriod(TimeUnit.SECONDS.toMillis(1), 0);
for (int i=0; i<3; i++) {
region = new Region("rid", null, null, MyBeacons.getInstance().getMinor(i));
beaconManager.setMonitoringListener(new MonitoringListener() {
@Override
public void onEnteredRegion(Region region, List<Beacon> beacons) {
postNotification("MONITORING: Beacon " + MyBeacons.getInstance().getColor(beacons.get(0).getMinor()));
}
@Override
public void onExitedRegion(Region region) {
postNotification("Exited region");
}
});
}
}