根据我的理解,信标中的次要和主要ID用于分段(例如,主要用于实体店,而次要用于给定商店内的不同位置).
然后,由于信标不能提供丰富的有效载荷,我想这些ID将被利用来为用户提供足够的信息 - 并且可能通过web服务.
最后,据说UUID适用于整个舰队.根据我的理解,应用程序(例如零售商店)可能只注册一个或几个UUID(通常是一个,更多用于复杂的架构或服务过载).
在应用程序级别,您可以(1)当应用程序是前景时的信标范围(具有次要/主要ID的捕获功能),以及(2)monitoringForRegion:在后台+ 检测区域退出/进入()时提供UILocalNotification以唤醒app(回到(1)).
现在让我们来处理最终用户.我认为我们可以假设平均不会通过手中的应用程序通过整个零售商店,并且更有可能让它在后台运行.因此,情况(2)将是最常见的情况.但是,由于所有发射器将共享相同的UUID,并且在后台运行的地理定位管理器正在监视链接到UUID的区域,因此根据发射器的范围/配置,didEnter和didExit区域委托方法存在风险,无法智能触发.最后,并非所有想要向您的客户广播的室内基于位置的广告都将被接收和捕获.实际上,我担心只有客户到达商店位置时才会系统地建议(在后台模式环境中).
我错过了什么吗?
我怎样才能与iBeacons保持距离?我能够得到他们的proximity,但我怎样才能获得CLBeacon的距离?我使用过Estimote SDK,它给出了距离值,但我不知道如何用CLBeacon来获取它.
- (void)locationManager:(CLLocationManager *)manager
didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region{
if (self.beaconRegion) {
if([beacons count] > 0)
{
//get closes beacon and find its major
CLBeacon *beacon = [beacons objectAtIndex:0];
}
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nil];
/*
* Fill the table with beacon data.
*/
ESTBeacon *beacon = [self.beaconsArray objectAtIndex:indexPath.row];
beacon.delegate=self;
cell.textLabel.text = [NSString stringWithFormat:@"Major: %@, Minor: %@", beacon.major, beacon.minor];
cell.detailTextLabel.text = [NSString stringWithFormat:@"Distance: %.2f", [beacon.distance floatValue]];
[beacon connectToBeacon]; …Run Code Online (Sandbox Code Playgroud) Isssue 1:
我正在按照这个estimote教程创建我自己的Estimote应用程序.但是出现了这个错误:
未知类型名称'ESTBeaconRegion'; 你是说'CLBeaconRegion'吗?
怎么解决?
我已经包含了标题和代表
#import <EstimoteSDK/EstimoteSDK.h>
@interface AppDelegate () <UIApplicationDelegate,CLLocationManagerDelegate,ESTBeaconManagerDelegate>
Run Code Online (Sandbox Code Playgroud)
这是我的podFile
# Uncomment this line to define a global platform for your project
platform :ios, '7.0'
target 'Tabster' do
pod 'EstimoteSDK', '3.1.0'
end
Run Code Online (Sandbox Code Playgroud)
问题2: 为什么框架以红色突出显示?

更新:(尝试Juan Gonzalez建议的示例应用程序)

我现在有一个问题,因为我正试图从我的Onyx iBeacon读取tx-Power.我已经阅读了多个建议并在互联网上尝试了这么多代码,但我仍然无法解决这个问题.
我正在使用android棒棒糖,并尝试了来自https://github.com/devunwired/accessory-samples/tree/master/BluetoothGatt的iBeacon教程,
以获取蓝牙应用程序BLUETOOTH_THERM_SERVICE.
我从广告中找到了tx-Power的两个值: 蓝牙LE TX功率读数
0x1804和它的特点0x2A07,所以我改编了包裹UUID来过滤我的ScanResults 0x1804:
public static final ParcelUuid THERM_SERVICE = ParcelUuid.fromString("00001809-0000-1000-8000-00805f9b34fb");
public static final ParcelUuid TX_POWER_SERVICE = ParcelUuid.fromString("00001804-0000-1000-8000-00805F9B34FB");
public static final ParcelUuid ONYX_STANDARD_SERVICE = ParcelUuid.fromString("0000180a-0000-1000-8000-00805f9b34fb");
Run Code Online (Sandbox Code Playgroud)
如教程中所述:
byte[] data = record.getServiceData(TX_POWER_SERVICE);
Run Code Online (Sandbox Code Playgroud)
应该存储一个字节数组,但它总是返回null!唯一存储字节数组的东西,但我认为它存储整个记录是:
byte[] data = record.getServiceData(ONYX_STANDARD_SERVICE);
Run Code Online (Sandbox Code Playgroud)
尝试继续使用我可以获得的数据,ONYX_STANDARD_SERVICE我可以看到scanResult:
onScanResult() - ScanResult{mDevice=78:A5:04:07:AE:96, mScanRecord=ScanRecord [mAdvertiseFlags=6, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, 32, -54, -24, -96, -87, -49, 17, -29, -91, -30, 8, 0, 32, 12, -102, 102, 0, 7, -82, -106, -78]}, …Run Code Online (Sandbox Code Playgroud) bluetooth-lowenergy ibeacon ibeacon-android android-5.0-lollipop
我想用iBeacons构建一个简单的iOS应用程序.
我有四个iBeacons,我的目标是通过Trilateration来计算我的房间位置.我想在显示屏上显示房间,设置iBeacons的固定位置,然后计算位置并在显示屏上显示.
我的问题是,我不知道如何开始.
我正在使用IBM Presence Insights和我的Android App + Estimote SDK.SDK会在进入时选择Beacon UUID,主要和次要.接下来,它成功将事件发送到PI.但是,如何将退出事件发送到PI,因为没有"退出"API或参数?
出于部署简单的原因,我参与了一个商业案例,迟早会出现这个问题:
对于iOS,将使用集成的iBeacon支持.对于Android,将使用AltBeacon库(由Radius提供).
如果给定内容/交互的所有信标,并且彼此非常接近,并且可能也重叠,是否共享相同的UUID,主要ID和次要ID,是否存在任何基本问题和陷阱?
他们都将ping相同的信息,所以从理论上讲,至少应用程序只会看到很多来自看似相同设备的ping,除非系统中的某个地方MAC地址也将起到识别源的作用.
我很感谢有关这方面的任何实际建议.我们可能会谈论数百个在移动车辆中散布的信标,每辆车不止一个.
此致,安德斯
我使用以下代码行创建CLBeaconRegion,然后location manager按以下方式调用:
let beaconRegion:CLBeaconRegion = CLBeaconRegion(proximityUUID: beaconUUID as UUID,
identifier: beaconIdentifier)
/// save a beacon region for stopping after.
(beaconInfo as! BeaconInfo).beaconRegion = beaconRegion
/// start monitoring the specified region.
self.locationManager.startMonitoring(for: beaconRegion)
/// start calculating ranges for beacons in the specified region.
self.locationManager.startRangingBeacons(in: beaconRegion)
Run Code Online (Sandbox Code Playgroud)
位置管理器委托内的代码是:
func locationManager(_ manager: CLLocationManager,
didRangeBeacons beacons: [CLBeacon],
in region: CLBeaconRegion) {
/// it may be assumed no beacons that match the specified region are nearby.
if beacons.count == 0 {
print …Run Code Online (Sandbox Code Playgroud) 我写了一个代码,在Beacon范围内有弹出通知.
我的通知代码如下:
private void showNotification(String message){
Log.d("Hay8","DCM8");
Intent intent = new Intent(context, MainActivity.class);
Log.d("Hay9","DCM9");
PendingIntent pendingIntent = PendingIntent.getActivity(context,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
Log.d("Hay10","DCM10");
NotificationCompat.Builder builder = new NotificationCompat.Builder(context,"default")
.setSmallIcon(android.R.drawable.ic_dialog_info)
.setContentTitle("Notification1")
.setContentText(message)
.setDefaults(NotificationCompat.DEFAULT_ALL)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentIntent(pendingIntent);
Log.d("Hay11","DCM11");
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Log.d("Hay12","DCM12");
notificationManager.notify(NotiID++,builder.build());
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用日志调试,我认为问题是关于NotificationManager方法.这是日志:
05-23 17:23:30.774 18668-18668/com.example.user.estimotebeacon D/Hay8: DCM8
05-23 17:23:30.774 18668-18668/com.example.user.estimotebeacon D/Hay9: DCM9
05-23 17:23:30.776 18668-18668/com.example.user.estimotebeacon D/Hay10: DCM10
05-23 17:23:30.780 18668-18668/com.example.user.estimotebeacon D/Hay11: DCM11
05-23 17:23:30.781 18668-18668/com.example.user.estimotebeacon D/Hay12: DCM12
05-23 17:23:30.788 18668-18668/com.example.user.estimotebeacon E/NotificationManager: notifyAsUser: tag=null, id=1, user=UserHandle{0}
05-23 17:23:30.798 18668-18668/com.example.user.estimotebeacon D/Hay20: DCM20
05-23 17:23:30.859 …Run Code Online (Sandbox Code Playgroud)