【发布时间】:2017-07-17 11:11:52
【问题描述】:
我已将 Android 信标库用于我的信标解决方案之一。有没有办法延迟范围通知器生成的数据,因为它非常频繁地提供数据。 下面是我所指的代码。要查看完整代码,您可以转到此线程“Android iBeacon App not working in the background”
@Override
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
if(beacons.size() > 0) {
for (Beacon beacon : beacons) {
if (beacon.getDistance() < 1.0) {
Log.d(TAG, "I see a beacon transmitting a : " +
" approximately " + beacon.getDistance() + " meters away.");
Log.d(TAG, "BEACON DATA : " +beacon.getBluetoothAddress()+":"+beacon.getBluetoothName()+":"+beacon.getId1());
showNotification("Treewalker","You are near beacon range");
Intent intent = new Intent(this,MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
}
}
}
}
【问题讨论】:
标签: android ibeacon ibeacon-android beacon android-ibeacon