import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIUtils;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;

public class HttpClientUtil {

 List<NameValuePair> params;
 
 public ArrayList<StoreInfoDTO> getStoreInfoList(){
  getParams();
  String query = URLEncodedUtils.format(params, "UTF-8");  
  URI uri;
  try {   
   uri = URIUtils.createURI("http", "maps.google.co.kr", -1, "/m/local", query, null);   
   HttpClient client = new DefaultHttpClient();    
   HttpGet getMethod = new HttpGet();
   getMethod.setURI(uri);
   ResponseHandler<String> responseHandler = new BasicResponseHandler();   
   String responseBody = client.execute(getMethod, responseHandler);   
  } catch (URISyntaxException e) {   
   e.printStackTrace();
  } catch (ClientProtocolException e) {
   // TODO Auto-generated catch block   
   e.printStackTrace();
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
  return null;
 }
 
 public List<NameValuePair> getParams(){
  params = new ArrayList<NameValuePair>();
  // 検索語
  params.add(new BasicNameValuePair("q", "병원"));
  // 近辺地域検索
  //params.add(new BasicNameValuePair("near", nearAddress.get(0).getAddressLine(0)));
  params.add(new BasicNameValuePair("near", "서울특별시 도봉구 방학동"));
  // 結果フォーマット - json   
  params.add(new BasicNameValuePair("output", "json"));
  // 検索結果範囲決定(all:全て検索, yp:ビジネス領域検索, websearch:web検索 などなど)  
  params.add(new BasicNameValuePair("mrt", "yp"));    
  // 言語   
  //params.add(new BasicNameValuePair("hl", "kr"));    
  // 検索半径 30km, miles = kilometers / 1.60934   
  params.add(new BasicNameValuePair("radius", "2.641"));     
  // 検索数   
  params.add(new BasicNameValuePair("num", "10"));   
  
  return params;
 } 
}

 

위의 소스인데요

 

MapViewActivity에서 HttpClientUtil클래스의 getStoreInfoList()함수를 호출해서 가게정보를 취득하려고 하는데요

String responseBody = client.execute(getMethod, responseHandler);   <<< 이부분에서 ClientProtocolException으로 빠지는데 이유를 모르겠습니다(에러내용 org.apache.http.client.HttpResponseException' Not Found)

 

테스트는 단말기에서 하고 있습니다

퍼미션은 아래의 3개를 설정했습니다

android.permission.INTERNET

android.permission.ACCESS_FINE_LOCATION

android.permission.ACCESS_COARSE_LOCATION

 

혹시 조그마한 힌트라고 알고계신분 있으시면 도와주세요ㅠㅜ