Is it possible to programmatically route a request through mobile data even when the wifi is on and connected to the internet?
My app needs to call a service provided by the operator which is only available through mobile data and I don't think it's user-friendly to ask for turning off the wifi.
Android actually does support simultaneous connection for both 3G and WiFi devices, through an amazing app called SuperSpeed. On LTE phones it will dramatically increase connect speeds.As others have said, when both WiFi and 3G are simultaneously connected, only WiFi will work.
To do this, swipe down on your notification bar and check that the mobile data toggle is switched on. Or go into “Settings,” tap “Connections,” and “Data Usage” and make sure that mobile data is switched on. Step 2: Connect to a Wi-Fi network. Tap “Settings,” then “Connections”, then “Wi-Fi” and flip the switch on.
If your phone detects that the Wi-Fi network stutters, it will switch to the mobile network, so that your phone still consumes mobile data even if it is connected to the Wi-Fi network. To disable Wi-Fi+, go to Settings, search for and access Wi-Fi+, and disable it.
Sharing a connection this way is called tethering or using a hotspot. Some phones can share Wi-Fi connection by tethering. Most Android phones can share mobile data by Wi-Fi, Bluetooth, or USB.
take a look at https://developer.android.com/reference/android/net/ConnectivityManager.html
specifically, it has a function that allows you to do what you want.
5 Provide an API that allows applications to request and select networks for their data traffic
you request a network, and then setDefaultNetwork( API before 23) or use bindProcessToNetwork for API >= 23 .
you probably want to request a network with int TRANSPORT_CELLULAR capabilities (https://developer.android.com/reference/android/net/NetworkCapabilities.html)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With