Android版基于高德地图和Foursquare的全球Poi搜索工具,整合后实现类似于微信的搜索效果,国内显示从高德搜索到的数据,在国外显示从Foursquare搜索到的结果,使得结果尽可能的准确。
go to AMap Console Already Built in.
go to Foursquare Developers.
compile 'mobi.chy:GlobalPoiSearch:1.0.0'
<meta-data
android:name="FOURSQUARE_CLIENT_ID"
android:value="your CLIENT_ID" />
<meta-data
android:name="FOURSQUARE_CLIENT_SECRET"
android:value="your CLIENT_SECRET" />
GlobalPoiSearch globalPoiSearch = new GlobalPoiSearch(this);
globalPoiSearch.setOnPoiSearchListener(new GlobalPoiSearch.PoiSearchListener{
@Override
public void onPoiSearchSuccess(int totalCount, List<GlobalPoi> poiList) {
//search success, do your work...
}
@Override
public void onPoiSearchFailed(int errCode, String errDesc) {
//search failed, do your work...
}
@Override
public void onPoiSearchFinish() {
//search finished.
}
});
//search a latitude and longitude point.
globalPoiSearch.queryLatLng(lat, lng, 0);
//search a nearby place by keywords.
globalPoiSearch.queryAMap(etKeyword.getText().toString(),etCity.getText().toString(), 0);
globalPoiSearch.queryFoursquare(etKeyword.getText().toString(), etCity.getText().toString());