public void onBeaconServiceConnect() {
beaconManager.addMonitorNotifier(new MonitorNotifier() {
@Override
public void didEnterRegion(Region region) {
try {
beaconManager.startRangingBeaconsInRegion(region);
} catch (RemoteException e) {
}
}
@Override
public void didExitRegion(Region region) {
try {
int k = 0;
beaconManager.stopRangingBeaconsInRegion(region);
} catch (RemoteException e) {
int i = 0;
}
}
@Override
public void didDetermineStateForRegion(int i, Region region) {
if (beaconManager.getRangedRegions().contains(region) == false) {
try {
beaconManager.startRangingBeaconsInRegion(region);
} catch (RemoteException e) {
}
}
}
});
beaconManager.addRangeNotifier(new RangeNotifier() {
@Override
public void didRangeBeaconsInRegion(Collection<Beacon> collection, Region region) {
for (Beacon beacon: collection) {
int j = 0;
}
}
});
try {
Identifier id = Identifier.parse("8492E75F-4FD6-469D-B132-043FE94921D8");
beaconManager.startMonitoringBeaconsInRegion(new Region("8492E75F-4FD6-469D-B132-043FE94921D8", null, null, null));
} catch (RemoteException e) {
int i = 0;
}
}
This is my code, everything looks fine until i get to didRangeBeaconsInRegion, beacons is always empty.
My log is full of this two lines: D/BluetoothAdapter: scan not started yet D/BluetoothAdapter: stopLeScan()