轨迹查询
// 设置协议类型,0为http,1为https
int protocoType = 1;
client.setProtocolType(protocoType);
//鹰眼服务ID
long serviceId = <开发者创建的鹰眼服务的ID>;
//entity标识列表(多个entityName,以英文逗号"," 分割)
String entityNames = "mycar1,mycar2,mycar3";
//检索条件(格式为 : "key1=value1,key2=value2,.....")
String columnKey = "car_team=1";
//返回结果的类型(0 : 返回全部结果,1 : 只返回entityName的列表)
int returnType = 0;
//活跃时间,UNIX时间戳(指定该字段时,返回从该时间点之后仍有位置变动的entity的实时点集合)
int activeTime = (int) (System.currentTimeMillis() / 1000 - 12 * 60 * 60);
//分页大小
int pageSize = 1000;
//分页索引
int pageIndex = 1;
//Entity监听器
OnEntityListener entityListener = new OnEntityListener() {
// 查询失败回调接口
@Override
public void onRequestFailedCallback(String arg0) {
System.out.println("entity请求失败回调接口消息 : " + arg0);
}
// 查询entity回调接口,返回查询结果列表
@Override
public void onQueryEntityListCallback(String arg0) {
System.out.println("entity回调接口消息 : " + arg0);
}
};
//查询实时轨迹
client.queryEntityList(serviceId, entityNames, columnKey, returnType, activeTime, pageSize, pageIndex, entityListener);
//鹰眼服务ID
long serviceId = <开发者创建的鹰眼服务的ID>;
//entity标识
String entityName = "mycar1";
//是否返回精简的结果(0 : 将只返回经纬度,1 : 将返回经纬度及其他属性信息)
int simpleReturn = 0;
//开始时间(Unix时间戳)
int startTime = (int) (System.currentTimeMillis() / 1000 - 12 * 60 * 60);
//结束时间(Unix时间戳)
int endTime = (int) (System.currentTimeMillis() / 1000);
//分页大小
int pageSize = 1000;
//分页索引
int pageIndex = 1;
//轨迹查询监听器
OnTrackListener trackListener = new OnTrackListener() {
//请求失败回调接口
@Override
public void onRequestFailedCallback(String arg0) {
System.out.println("track请求失败回调接口消息 : " + arg0);
}
// 查询历史轨迹回调接口
@Override
public void onQueryHistoryTrackCallback(String arg0) {
System.out.println("查询历史轨迹回调接口消息 : " + arg0);
}
};
//查询历史轨迹
client.queryHistoryTrack(serviceId, entityName, simpleReturn, startTime, endTime, pageSize, pageIndex,trackListener);

修改于 2022-08-08 04:01:44