简体   繁体   中英

How to force using internet from 3G even when connected to WIFI?

I'm working on an application that connects to a hardware device using WIFI. Basically, the device creates a wifi network that is used to communicate with it.

The problem is that this device is not a router and does not provide an internet connection. So when I connected to this device using the wifi connection I lose all network capabilities from my Android device. I can't update the server or do any other task that requires an internet connection.

On iPhone in this case, the device can recognize the fact that the WIFI does not provide a connection to the network and switches automatically to use the 3g connection.

So the question is: Is there a way to force network traffic to go through the 3G connection even when I have WIFI connection established?

Try using this method on the application below to make the connection to happen only with 3G.

public boolean requestRouteToHost (int networkType, int hostAddress).

Pass the parameters for Network type and the host address to specify the connection type and target endpoint.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM