SearchRequest searchRequest = new SearchRequest("shopping");
searchRequest.setSearchCenter(m_map.getCenter());
searchRequest.setSearchArea(new GeoCoordinate(18.467518, 73.777694), 5000);
searchRequest.execute(discoveryResultPageListener);
结果是
private ResultListener<DiscoveryResultPage> discoveryResultPageListener = new ResultListener<DiscoveryResultPage>() {
@Override
public void onCompleted(DiscoveryResultPage discoveryResultPage, ErrorCode errorCode) {
if (errorCode == ErrorCode.NONE) {
/* No error returned,let's handle the results */
m_placeDetailButton.setVisibility(View.VISIBLE);
s_ResultList = discoveryResultPage.getItems();
for (DiscoveryResult item : s_ResultList) {
if (item.getResultType() == DiscoveryResult.ResultType.PLACE) {
PlaceLink placeLink = (PlaceLink) item;
addMarkerAtPlace(placeLink);
}
}
} else {
Toast.makeText(m_activity,
"ERROR:Discovery search request returned return error code+ " + errorCode,
Toast.LENGTH_SHORT).show();
}
}
};
此外,我们在这里实现了将Android SDK API映射到高级版本上,这样搜索位置就可以正常工作。但在高级版本中,安卓APK的大小已经超过65MB。
提前谢谢你!