android - 使用 HttpUriRequest 与 HttpURLConnection 的优缺点是什么?

标签 android performance httprequest droidquery

我为 Android 制作了几个使用 HttpUriRequest 的应用程序和库创建网络请求(例如,我的 droidQuery 库),但是我已经看到一些使用 OkHttp 的新库出现(例如 HttpURLConnection,这意味着非常快)相反。

HttpURLConnection 是否提供比 HttpUriRequest 更快的连接,或者这两个类是否基本等同?使用其中一个的优点和缺点是什么?

最佳答案

这在 Android Dev Blog 上得到了回答:

哪个客户端最好?

Apache HTTP client has fewer bugs on Eclair and Froyo. It is the best choice for these releases.

For Gingerbread and better, HttpURLConnection is the best choice. Its simple API and small size makes it great fit for Android. Transparent compression and response caching reduce network use, improve speed and save battery. New applications should use HttpURLConnection; it is where we will be spending our energy going forward.

关于android - 使用 HttpUriRequest 与 HttpURLConnection 的优缺点是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17981750/

相关文章:

python - Keras 模型训练时间太长

grails - 在 Grails 中,如何获取包含请求参数的请求 URI?

angular - 从 Angular 中的 get Http 请求获取 header

Android:纠正 Lint 警告是否有用?

java - 如何制作动画Activity过渡

performance - React Native 与 Redux 的低性能

r - 通过 httr 对 SPARQL 公共(public)可用端点正确发出 POST 查询

android - onSaveInstanceState() 未调用 : why?

安卓音乐播放器小部件

javascript - DOM 操作与模板