rajarshi
rajarshi

Reputation: 131

How do I force Android to use wifi network instead of mobile network

I have a use case where I need to use Wifi network for my requests instead of the mobile network. The mobile device has already connected to the Wifi network. But Android seems to always resolve network requests using the mobile data network instead of the Wifi network. Note that the Wifi network does not have internet access, it is simply a wifi access point exposed by an external device during setup.

I tried using ConnectivityManager's setNetworkPreference(ConnectivityManager.TYPE_WIFI) but that did not work.

Upvotes: 7

Views: 9605

Answers (1)

tutacat
tutacat

Reputation: 99

Disable mobile data while wifi setup is required. It won't resolve any requests with a carrier network if this is enabled.

Enable aeroplane mode, then toggle wifi

Upvotes: 2

Related Questions