估算信标IOS - 搜索信标,只有UUID值
问题描述:
我到Estimote烽火台应用开发,并能发送邮件使用示例应用程序,其中UUID,主要和次要值中显式代码硬编码的通知。我想下面的要求使用Objective C.估算信标IOS - 搜索信标,只有UUID值
- 应用程序将搜索基于UUID信号灯,如果我有10个信标,信标是基于主要和次要价值观分化和UUID保持不变来实现。
- 一旦通知发出,用户点击应用程序和应用程序应该能够确定在范围内的灯塔的主要和次要值。
- 此外,有可能使一个自定义的服务呼叫与发送该通知一起?
我能够使用下面的代码与硬编码的UUID,次要和主要值发送通知。
这是为我工作的代码是下面一个:
self.beaconNotificationsManager = [BeaconNotificationsManager new];
[self.beaconNotificationsManager enableNotificationsForBeaconID: [[BeaconID alloc] initWithUUIDString:@"MY UUID" major: 10708 minor:33584] enterMessage:@"Enter Message." exitMessage:@"Exit Message"];
感谢, SIB移动开发
答
您可以使用测距航标实现发送“进入”和“退出”通知和后台服务电话。
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"YOURUUID"];
self.beaconManager = [[ESTBeaconManager alloc] init];
self.beaconManager.delegate = self;
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"RegionIdenifier"];
self.beaconRegion.notifyOnEntry = YES;
self.beaconRegion.notifyOnExit = YES;
self.beaconRegion.notifyEntryStateOnDisplay = YES;
然后发送委派方法内通知:
-(void)beaconManager:(ESTBeaconManager *)manager didEnterRegion:(CLBeaconRegion *)region
{
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = @"Enter region notification";
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}
-(void)beaconManager:(ESTBeaconManager *)manager didExitRegion:(CLBeaconRegion *)region
{
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = @"Exit region notification";
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}