Reputation: 12375
I have the follow object
HttpTransport t = AndroidHttp.newCompatibleTransport();
but whole AndroidHttp
class (com.google.api.client.extensions.android.http.AndroidHttp
) is marked as deprecated.
I don't know what is the class that replaces this, using newer libraries.
How could I replace this obsolete call?
Upvotes: 12
Views: 3591
Reputation: 4206
This link tells us that prior to Gingerbread the HttpURLConnection implementation was buggy and Apache HTTP Client was preferred.
However this has been fixed for newer versions and now new NetHttpTransport()
can be used directly. So just use: HttpTransport t = new NetHttpTransport();
and you should be fine.
This is also what newCompatibleTransport
does behind the curtain:
public static HttpTransport newCompatibleTransport() {
return AndroidUtils.isMinimumSdkLevel(9) ? new NetHttpTransport() : new ApacheHttpTransport();
}
Upvotes: 21