Android API 和 Http 连接函数
Android API's and Http Connection Functions
android API 与 HttpPost
函数的作用以及 android API 与 HttpURLConnection
函数的作用?我正在尝试为调用 PHP 文件以连接数据库的 android 应用程序创建 Java 代码,并且我想确保我的代码与任何 Android API 手机 phone 已 运行 开机。
Which client is best?
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.
Apache HTTP,因此 HttpPost
已被弃用,HTTPURLConnection
受到鼓励,但这并不重要。
您甚至可以使用 Retrofit、Ion、AsyncHttpClient、Volley、OkHttp ... Android HTTP 库列表还在继续。
如果您真的关心 API 版本,请使用 HttpURLConnection
如果您想使用旧版 Apache HTTP,请编译它
android {
compileSdkVersion ...
buildToolsVersion "..."
useLibrary 'org.apache.http.legacy' // Add this line
android API 与 HttpPost
函数的作用以及 android API 与 HttpURLConnection
函数的作用?我正在尝试为调用 PHP 文件以连接数据库的 android 应用程序创建 Java 代码,并且我想确保我的代码与任何 Android API 手机 phone 已 运行 开机。
Which client is best?
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.
Apache HTTP,因此 HttpPost
已被弃用,HTTPURLConnection
受到鼓励,但这并不重要。
您甚至可以使用 Retrofit、Ion、AsyncHttpClient、Volley、OkHttp ... Android HTTP 库列表还在继续。
如果您真的关心 API 版本,请使用 HttpURLConnection
如果您想使用旧版 Apache HTTP,请编译它
android {
compileSdkVersion ...
buildToolsVersion "..."
useLibrary 'org.apache.http.legacy' // Add this line