Hello there , I would need some help regarding monitoring.
I am developing an application in which I want to define multiple regions and show a particular notification depending in which region the user is .
I want to know how I am able to do this .
From what I know I should start monitoring all the regions I want using the Beacon Manager, but I want to know how I am able to make the Monitoring Listener to know what to display on the entered region depending on the region I am . Below I have my code. Thank you in advance.
private BeaconManager beaconManager;
@Override
public void onCreate(Bundle icicle)
{
final Region region1 = new Region(
"monitored region",
UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D"),
22504, 44827);
final Region region2 = new Region(
"monitored region",
UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D"),
22544, 48427);
final Region region3 = new Region(
"monitored region",
UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D"),
2254, 48327);
super.onCreate(icicle);
beaconManager = new BeaconManager(getApplicationContext());
beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
@Override
public void onServiceReady() {
beaconManager.startMonitoring(region1);
beaconManager.startMonitoring(region2);
beaconManager.startMonitoring(region3);
}
});
beaconManager.setMonitoringListener(new BeaconManager.MonitoringListener() {
@Override
public void onEnteredRegion(Region region, List<Beacon> list) {
shownotification();
}
@Override
public void onExitedRegion(Region region) {
}
});