20m alanındaki herhangi bir banka için Goolge Places Pages öğesini uzun/lat olarak aramam gerekiyor. Bu Google Places Doc, JavaScript ile nasıl yapılacağını açıklar. Java'da sahip olmadığım bir google.maps.LatLng
Nesnesi kullanıyorlar.Java ile bir Google Rehber Arama İsteği nasıl gönderilir
Artık Hizmet'i nasıl arayacaksınız?
Belki de Goolge Places için bir Java API'si var mı?
Saygılarımızla, Christian.
Düzenleme 1:
böyle url inşa someone bulundu:String url = baseUrl + "location=" + lat + "," + lon + "&" +
"radius=" + searchRadius + "&" + types + "&" + "sensor=true" +
"&" + "key=" + googleAPIKey;
Cevap: Düzenleme 2: Çünkü yazının
i nasıl yapılacağını öğrendim yukarıda.
İştepublic class GooglePlacesClient
{
private static final String GOOGLE_API_KEY = "***";
private final HttpClient client = new DefaultHttpClient();
public static void main(final String[] args) throws ParseException, IOException, URISyntaxException
{
new GooglePlacesClient().performSearch("establishment", 8.6668310, 50.1093060);
}
public void performSearch(final String types, final double lon, final double lat) throws ParseException, IOException, URISyntaxException
{
final URIBuilder builder = new URIBuilder().setScheme("https").setHost("maps.googleapis.com").setPath("/maps/api/place/search/json");
builder.addParameter("location", lat + "," + lon);
builder.addParameter("radius", "5");
builder.addParameter("types", types);
builder.addParameter("sensor", "true");
builder.addParameter("key", GooglePlacesClient.GOOGLE_API_KEY);
final HttpUriRequest request = new HttpGet(builder.build());
final HttpResponse execute = this.client.execute(request);
final String response = EntityUtils.toString(execute.getEntity());
System.out.println(response);
}
}
Hayatımı kurtardığın için teşekkür ederim. :) – Kunal
Çok fazla thnks !!! –