Android 选择 HTTP POST 的连接类型
因为我无法控制当时哪些连接处于打开状态。如果用户在其设置中启用了数据连接和 Wifi 连接,我可以选择使用哪个连接来执行 HTTP POST?如果不是,Android 会选择更省电的 Wifi 吗?
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, Will Android choose the more battery efficient one, Wifi?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Android 将使用用户当前连接的那个。
由于 Android 优先考虑 Wi-Fi 而非常规数据连接,因此它将使用 Wi-Fi 连接(如果移动设备已连接到 Wi-Fi)。如果两者均已激活但设备未连接到 Wi-Fi 网络,它将使用数据连接。
您还可以看到这一点,如果您在设备上启用这两种连接(使用 Android 2.2),它会自动切换到 Wi-Fi 连接(如果存在)。它确实更好、更快而且通常更便宜。
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.