重要:为进一步采取加强对最终用户个人信息的安全保护措施,从鹰眼SDK v3.1.5版本起,请开发者务必确保调用SDK任何接口前先调用隐私合规接口setAgreePrivacy,否则可能会无法正常使用相关功能。具体可参考开发指南-开发注意事项-隐私政策接口说明。
鹰眼可对有定位能力的终端实现轨迹管理,并支持多端接入,可查询实时/历史终端位置及轨迹,实现轨迹信息可视化,同时鹰眼电子围栏具备信息主动推送能力,能实现终端进出围栏报警推送,广泛应用在物流、出行、金融、信息科技、智能硬件等多个行业。鹰眼采用PB级数据存储,基于百度成熟分布式存储系统,进行多地域三备份存储,多形式数据安全保护,具备极高数据安全能力。
#import <BaiduTraceSDK/BaiduTraceSDK.h>// 开启服务之间先配置轨迹服务的基础信息BTKServiceOption *basicInfoOption = [[BTKServiceOption alloc] initWithAK:@"您的AK" mcode:@"您的bundle id" serviceID:@"您的serviceID" keepAlive:YES];[[BTKAction sharedInstance] initInfo:basicInfoOption];// 开启服务BTKStartServiceOption *startServiceOption = [[BTKStartServiceOption alloc] initWithEntityName:@"entityName"];[[BTKAction sharedInstance] startService:startServiceOption delegate:self];// 停止服务[[BTKAction sharedInstance] stopService:self];//开始采集[[BTKAction sharedInstance] startGather:self];//结束采集[[BTKAction sharedInstance] stopGather:self];/**开启轨迹服务的回调方法@param error 开启轨迹服务的结果*/-(void)onStartService:(BTKServiceErrorCode) error {}/**停止轨迹服务的回调方法@param error 停止轨迹服务的结果*/-(void)onStopService:(BTKServiceErrorCode) error {}/**开始采集的回调方法@param error 开始采集的操作结果*/-(void)onStartGather:(BTKGatherErrorCode) error {}/**停止采集的回调方法@param error 停止采集的操作结果*/-(void)onStopGather:(BTKGatherErrorCode) error {}
// 设置检索的过滤条件BTKQueryEntityFilterOption *filterOption = [[BTKQueryEntityFilterOption alloc] init];filterOption.entityNames = @[@"Test"];filterOption.activeTime = [[NSDate date] timeIntervalSince1970] - 7 * 24 * 3600;// 设置检索结果的排序方式BTKSearchEntitySortByOption * sortbyOption = [[BTKSearchEntitySortByOption alloc] init];sortbyOption.fieldName = @"loc_time";sortbyOption.sortType = BTK_ENTITY_SORT_TYPE_DESC;// 构造检索请求对象BTKAroundSearchEntityRequest *request = [[BTKAroundSearchEntityRequest alloc] initWithCenter:center inputCoordType:BTK_COORDTYPE_BD09LL radius:1000 filter:filterOption sortby:sortbyOption outputCoordType:BTK_COORDTYPE_BD09LL pageIndex:1 pageSize:10 ServiceID:@"您的serviceID" tag:@"本次请求的标示"];// 发起检索请求[[BTKEntityAction sharedInstance] aroundSearchEntityWith:request delegate:self];#pragma mark - entity终端检索/**圆形区域检索Entity终端实体的回调方法@param response 检索结果*/-(void)onEntityAroundSearch:(NSData *)response {dispatch_async(dispatch_get_main_queue(), ^{NSDictionary *content = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];//转换数据格式NSLog(@"检索结果:%@",content);});}
// 构造请求对象NSUInteger endTime = [[NSDate date] timeIntervalSince1970];BTKQueryHistoryTrackRequest *request = [[BTKQueryHistoryTrackRequest alloc] initWithEntityName:@"entityA" startTime:endTime - 84400 endTime:endTime isProcessed:TRUE processOption:nil supplementMode:BTK_TRACK_PROCESS_OPTION_SUPPLEMENT_MODE_WALKING outputCoordType:BTK_COORDTYPE_BD09LL sortType:BTK_TRACK_SORT_TYPE_DESC pageIndex:1 pageSize:10 serviceID:103044 tag:13];// 发起查询请求[[BTKTrackAction sharedInstance] queryHistoryTrackWith:request delegate:self];/**轨迹查询的回调方法@param response 查询结果*/-(void)onQueryHistoryTrack:(NSData *)response {//解析数据,绘制轨迹}
// 设置纠偏选项BTKQueryTrackProcessOption *option = [[BTKQueryTrackProcessOption alloc] init];option.denoise = TRUE;option.mapMatch = TRUE;option.radiusThreshold = 15;option.transportMode = BTK_TRACK_PROCESS_OPTION_TRANSPORT_MODE_DRIVING;NSUInteger endTime = [[NSDate date] timeIntervalSince1970];// 构造请求对象BTKQueryTrackDistanceRequest *request = [[BTKQueryTrackDistanceRequest alloc] initWithEntityName:@"entityA" startTime:endTime - 84400 endTime:endTime isProcessed:TRUE processOption:nil supplementMode:BTK_TRACK_PROCESS_OPTION_SUPPLEMENT_MODE_WALkING serviceID:100000 tag:12];// 发起查询请求[[BTKTrackAction sharedInstance] queryTrackDistanceWith:request delegate:self];
//创建围栏// 圆心CLLocationCoordinate2D center = CLLocationCoordinate2DMake(40.0478, 116.3134);// 构造将要创建的新的围栏对象BTKServerCircleFence *fence = [[BTKServerCircleFence alloc] initWithCenter:center radius:50 coordType:BTK_COORDTYPE_BD09LL denoiseAccuracy:50 fenceName:@"server_circle_fence" monitoredObject:@"entityA"];// 构造请求对象BTKCreateServerFenceRequest *circleRequest = [[BTKCreateServerFenceRequest alloc] initWithServerCircleFence:fence serviceID:100000 tag:21];// 发起创建请求[[BTKFenceAction sharedInstance] createServerFenceWith:circleRequest delegate:self];//删除围栏// 构造请求对象BTKDeleteServerFenceRequest *request = [[BTKDeleteServerFenceRequest alloc] initWithMonitoredObject:@"entityA" fenceIDs:nil serviceID:100000 tag:22];// 发起删除请求[[BTKFenceAction sharedInstance] deleteServerFenceWith:request delegate:self];//实时状态查询// 构建请求对象BTKQueryServerFenceStatusRequest *request = [[BTKQueryServerFenceStatusRequest alloc] initWithMonitoredObject:@"entityA" fenceIDs:nil ServiceID:100000 tag:25];// 发起查询请求[[BTKFenceAction sharedInstance] queryServerFenceStatusWith:request delegate:self];
//停留点分析NSUInteger endTime = [[NSDate date] timeIntervalSince1970];// 构造请求对象BTKStayPointAnalysisRequest *request = [[BTKStayPointAnalysisRequest alloc] initWithEntityName:@"entityA" startTime:endTime - 12 * 60 * 60 endTime:endTime stayTime:100 stayRadius:20 processOption:nil outputCoordType:BTK_COORDTYPE_BD09LL serviceID:100000 tag:222];// 发起请求[[BTKAnalysisAction sharedInstance] analyzeStayPointWith:request delegate:self];/**停留点分析的回调方法@param response 停留点分析的结果*/-(void)onAnalyzeStayPoint:(NSData *)response {}//驾车行为分析NSUInteger endTime = [[NSDate date] timeIntervalSince1970];// 构造请求对象BTKDrivingBehaviourAnalysisRequest *request = [[BTKDrivingBehaviourAnalysisRequest alloc] initWithEntityName:@"zhubei" startTime:endTime - 12 * 60 * 60 endTime:endTime speedingThreshold:50 processOption:nil outputCoordType:BTK_COORDTYPE_BD09LL serviceID:103044 tag:223];// 发起请求[[BTKAnalysisAction sharedInstance] analyzeDrivingBehaviourWith:request delegate:self];/**驾驶行为分析的回调方法@param response 驾驶行为分析的结果*/-(void)onAnalyzeDrivingBehaviour:(NSData *)response {}
下一篇
本篇文章对您是否有帮助?