优先考虑 WIFI 连接而不是蜂窝数据

Prioritize WIFI connection instead Cellular data

我们正在开发一个使用 WIFI 连接到外部设备的应用程序,但是这个外部设备无法访问互联网。

在 Android M 中,我们已经意识到系统优先连接互联网访问,因此设备使用蜂窝数据而不是 WIFI 连接互联网。

该行为的问题是我们无法访问外部设备,因为该设备是通过蜂窝数据而不是 WIFI 连接的。

有没有办法让 Wifi 连接优先于蜂窝数据?

提前致谢。

我想这就是您要找的:http://developer.android.com/reference/android/net/ConnectivityManager.html#bindProcessToNetwork(android.net.Network)

这是类似的问题,只是反过来: How to use data connection instead of WIFI when both are enabled?