重要:为进一步采取加强对最终用户个人信息的安全保护措施,从鹰眼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_bd09llradius:1000filter:filteroption sortby:sortbyoption outputcoordtype:btk_coordtype_bd09llpageindex:1pagesize:10serviceid:@"您的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 =[nsjsonserializationjsonobjectwithdata:response options:nsjsonreadingmutablecontainers error:nil];//转换数据格式nslog(@"检索结果:%@",content);});}
// 构造请求对象nsuinteger endtime =[[nsdate date] timeintervalsince1970];btkqueryhistorytrackrequest*request =[[btkqueryhistorytrackrequest alloc] initwithentityname:@"entitya"starttime:endtime -84400endtime:endtime isprocessed:trueprocessoption:nil supplementmode:btk_track_process_option_supplement_mode_walkingoutputcoordtype:btk_coordtype_bd09llsorttype:btk_track_sort_type_descpageindex:1pagesize:10serviceid:103044tag: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 -84400endtime:endtime isprocessed:trueprocessoption:nil supplementmode:btk_track_process_option_supplement_mode_walking serviceid:100000tag:12];// 发起查询请求[[btktrackaction sharedinstance] querytrackdistancewith:request delegate:self];
//创建围栏// 圆心cllocationcoordinate2d center =cllocationcoordinate2dmake(40.0478,116.3134);// 构造将要创建的新的围栏对象btkservercirclefence*fence =[[btkservercirclefence alloc] initwithcenter:center radius:50coordtype:btk_coordtype_bd09lldenoiseaccuracy:50fencename:@"server_circle_fence"monitoredobject:@"entitya"];// 构造请求对象btkcreateserverfencerequest*circlerequest =[[btkcreateserverfencerequest alloc] initwithservercirclefence:fence serviceid:100000tag:21];// 发起创建请求[[btkfenceaction sharedinstance] createserverfencewith:circlerequest delegate:self];//删除围栏// 构造请求对象btkdeleteserverfencerequest*request =[[btkdeleteserverfencerequest alloc] initwithmonitoredobject:@"entitya"fenceids:nil serviceid:100000tag:22];// 发起删除请求[[btkfenceaction sharedinstance] deleteserverfencewith:request delegate:self];//实时状态查询// 构建请求对象btkqueryserverfencestatusrequest*request =[[btkqueryserverfencestatusrequest alloc] initwithmonitoredobject:@"entitya"fenceids:nil serviceid:100000tag:25];// 发起查询请求[[btkfenceaction sharedinstance] queryserverfencestatuswith:request delegate:self];
//停留点分析nsuinteger endtime =[[nsdate date] timeintervalsince1970];// 构造请求对象btkstaypointanalysisrequest*request =[[btkstaypointanalysisrequest alloc] initwithentityname:@"entitya"starttime:endtime -12*60*60endtime:endtime staytime:100stayradius:20processoption:nil outputcoordtype:btk_coordtype_bd09llserviceid:100000tag: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*60endtime:endtime speedingthreshold:50processoption:nil outputcoordtype:btk_coordtype_bd09llserviceid:103044tag:223];// 发起请求[[btkanalysisaction sharedinstance] analyzedrivingbehaviourwith:request delegate:self];/**驾驶行为分析的回调方法@param response 驾驶行为分析的结果*/-(void)onanalyzedrivingbehaviour:(nsdata*)response {}
百度鹰眼ios sdk,您需先,请先阅读百度地图api使用条款。 百度地图ios鹰眼sdk是提供给具有一定ios编程经验和了解面向对象概念的开发者使用。此外,读者还应该对地图的基本知识有一定的了解。您在使用中遇到任何问题,都可以通过反馈给我们,之后会有凯发k8官方旗舰厅的技术支持人员一对一为您处理问题。
下一篇
本篇文章对您是否有帮助?