2016-11-30 1 views
-1

Google Places API를 사용하여 특정 지역의 레스토랑 목록을 가져 와서 표시하고 싶습니다. 나는이 시도하지만, 아무것도 표시되지 않습니다, 나는 오류가없는 : 그래서 보이는JsonObjectRequest가 반환하지 않음

{ 
    "error_message": "This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console: https://console.developers.google.com/apis/api/places_backend?project=_", 
    "html_attributions": [], 
    "results": [], 
    "status": "REQUEST_DENIED" 
} 

: 웹 브라우저에서 URL 그것이 문제가 무엇인지 당신에게 말할 것이다하려고하면

String url="https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-45.730425,4.839938&radius=500&types=food&key=AIzaSyD8vqYPQzJRJa3rOLSC1wqIaUxSN0WcvGc"; 

JsonObjectRequest jsObjRequest = new JsonObjectRequest 
      (Request.Method.GET, url, null, new Response.Listener<JSONObject>() { 

       @Override 
       public void onResponse(JSONObject response) { 
        Log.d("json", response.toString()); 
       } 
      }, new Response.ErrorListener() { 

       @Override 
       public void onErrorResponse(VolleyError error) { 
        // TODO Auto-generated method stub 
        Log.d("json", "not working"); 
       } 
      }); 

답변

0

을 개발자 콘솔에서 API를 활성화하지 않은 것처럼 말입니다. 다음 https://console.developers.google.com/

하고

이동 장소의 상단에, 다음, 왼쪽 메뉴를 클릭 API 관리자에서 원하는 프로젝트를 검색 라이브러리를 클릭 한 다음 여기에서 원하는 결과를 클릭하면 "사용 가능"이라고 표시된 버튼이 표시되어야합니다.

다시 클릭하면 요청을 다시 시도하면 제대로 작동합니다.

편집 :

사용하는 링크는 응답으로 제공됩니다 그것에

https://console.developers.google.com/apis/api/places_backend

를 클릭하여이 페이지에서 API를 활성화 할 수있는 옵션이 있어야