SDK 版本: 3.1.0
sdk文档:http://lbsyun.baidu.com/index.php?title=android-yingyan/guide/searchtrack
查询实时位置
查询一或多个被追踪者的实时位置。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| long serviceId = <开发者创建的鹰眼服务的ID>;
String entityNames = "mycar1,mycar2,mycar3";
String columnKey = "car_team=1";
int returnType = 0;
int activeTime = (int) (System.currentTimeMillis() / 1000 - 12 * 60 * 60);
int pageSize = 1000;
int pageIndex = 1;
OnEntityListener entityListener = new OnEntityListener() { @Override public void onRequestFailedCallback(String arg0) { System.out.println("entity请求失败回调接口消息 : " + arg0); }
@Override public void onQueryEntityListCallback(String arg0) { System.out.println("entity回调接口消息 : " + arg0); } };
client.queryEntityList(serviceId, entityNames, columnKey, returnType, activeTime, pageSize, pageIndex, entityListener);
|
最新 3.1.0 版本中查询实体最终位置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| private void queryRealTimeLoc() { OnEntityListener entityListener = new OnEntityListener() { @Override public void onEntityListCallback(EntityListResponse entityListResponse) { Log.d("lallsdlalsdlasdlalsd", entityListResponse.getEntities().size() + " " + entityListResponse.getEntities().get(0).getLatestLocation()); Point point = entityListResponse.getEntities().get(0).getLatestLocation(); LatLng currentLatLng = mapUtil.convertTrace2Map(point.getLocation()); mapUtil.updateStatus(currentLatLng, true); } }; int activeTime = (int) (System.currentTimeMillis() / 1000 - 12 * 60 * 60); int pageSize = 1000; int pageIndex = 1; EntityListRequest request = new EntityListRequest(); request.setServiceId(trackApp.serviceId); request.setPageIndex(pageIndex); request.setPageSize(pageSize); FilterCondition condition = new FilterCondition(); List entityNames = new ArrayList<String>(); entityNames.add("xxxxxxxx"); entityNames.add("xxxxxxxx"); condition.setEntityNames(entityNames); condition.setActiveTime(activeTime); request.setFilterCondition(condition); trackApp.mClient.queryEntityList(request, entityListener); }
|