Tag: google places api

Android Retrofit + Google Places API(文本搜索)

我正在尝试根据给定的查询来获取地点。 我实现了以下接口。 @GET("api/place/textsearch/json?key=MY_API_KEY") Call<PlaceResponse> getNearbyPlacesByText(@Query("query") String query, @Query("location") String location, @Query("radius") int radius); 然后我这样调用这个方法 Retrofit retrofit = new Retrofit.Builder() .baseUrl(url) .addConverterFactory(GsonConverterFactory.create()) .build(); ApiInterface service = retrofit.create(ApiInterface.class); Call<PlaceResponse> callByText = service.getNearbyPlacesByText("psí" + "škola", currentLocation.getLatitude() + "," + currentLocation.getLongitude(), PROXIMITY_RADIUS); 然后我正在检索结果。 callByText.enqueue(new Callback<PlaceResponse>() { @Override public void onResponse(Call<PlaceResponse> call, Response<PlaceResponse> response) { List<Place> places = response.body().getResults(); Log.d(TAG, […]