I am trying to send a request to the Google GeoCode API using Retrofit. The service interface looks like this:
public interface FooService {
@GET(\"
I also wanted to clarify that if you have complex url parameters to build, you will need to build them manually. ie if your query is example.com/?latlng=-37,147, instead of providing the lat and lng values individually, you will need to build the latlng string externally, then provide it as a parameter, ie:
public interface LocationService {
@GET("/example/")
void getLocation(@Query(value="latlng", encoded=true) String latlng);
}
Note the encoded=true is necessary, otherwise retrofit will encode the comma in the string parameter. Usage:
String latlng = location.getLatitude() + "," + location.getLongitude();
service.getLocation(latlng);