我必须实现这种方法,但大多数库都已弃用。我需要一个与客户端 1.15.0rc 兼容的新版本。
public static HttpRequestFactory createRequestFactory(
final HttpTransport transport) {
return transport.createRequestFactory(new HttpRequestInitializer() {
public void initialize(HttpRequest request) {
GoogleHeaders headers = new GoogleHeaders();
headers.setApplicationName("AndroidHive-Places-Test");
request.setHeaders(headers);
JsonHttpParser parser = new JsonHttpParser(new JacksonFactory());
request.addParser(parser);
}
});
}
我无法解决的事情是:
GoogleHeaders headers = new GoogleHeaders();
和
JsonHttpParser parser = new JsonHttpParser(new JacksonFactory());