因此,基本上想要更新作为 ImageView 的布局,但为此需要停止对信标进行测距,并且正在使用 beaconManager.unbind(context) 并在更新图像后再次绑定 beaconManager.bind(context) 问题是这个上下文需要是“org.altbeacon.beacon.BeaconConsumer”如何创建该类型的上下文或者不是这种方式但需要调用beaconManager的另一个方法来停止范围并重新开始?
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
/*
if (beacons.size() > 0) {
Log.i(TAG, "The first beacon I see is about " + beacons.iterator().next().getDistance() + " meters away.");
}
*/
for(Beacon beacon: beacons){
double distancia = beacon.getDistance();
if(false) {
int rssi = beacon.getRssi();
int power = beacon.getTxPower();
//double distancia = beacon.getDistance();
distancias.add(beacon.getDistance());
Log.i(TAG, "Beacon detected with id1: " + beacon.getId1() + " id2:" + beacon.getId2() + " id3: " + beacon.getId3() + " distance: " + beacon.getDistance());
Log.i(TAG, "rss value->" + rssi + " power->" + power);
}
if(distancia <= 1.0){
Log.i(TAG,"esta a 1m de alcance");
/*
Bitmap bmp = BitmapFactory.decodeResource(context.getResources(),R.drawable.image5m);
Radar.setImageBitmap(bmp);
*/
}else if(distancia <= 2.0){/
Log.i(TAG,"esta a 2m de alcance");
//org.altbeacon.beacon.BeaconConsumer
//beaconManager.setAndroidLScanningDisabled(true);//setMonitorNotifier
beaconManager.unbind(ex);
Bitmap bmp = BitmapFactory.decodeResource(context.getResources(), R.drawable.image10m);
Radar.setImageBitmap(bmp);