开发者

Android Select Connection Type for HTTP POST

开发者 https://www.devze.com 2023-03-27 08:01 出处:网络
Since I have no control of which connections are on at the time. If the user has Data connection and Wifi connection enabled in their settings, can I choose which connection to use to do my HTTP POST?

Since I have no control of which connections are on at the time. If the user has Data connection and Wifi connection enabled in their settings, can I choose which connection to use to do my HTTP POST? If not, W开发者_如何转开发ill Android choose the more battery efficient one, Wifi?


Android will use the one that the user is currently connected with.

As Android privileges Wi-Fi over a regular Data connection it will use the Wi-Fi connection (if the mobile device is connected to one). If both are activated but the device is not connected to a Wi-Fi network, it will make use of the Data connection.

You can also see this in the fact that if you enable both on your device (using Android 2.2) it will automatically swap to the Wi-Fi connection if one is present. It is indeed better, faster and usually cheaper.

0

精彩评论

暂无评论...
验证码 换一张
取 消