Itβs not easy, what would you do.
First you need to support both network interfaces, itβs possible, but itβs a hack because Android does not support it. To do this, you must enable
connectivityManager.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, "feature");
The name of the function is associated with your equipment; it must be enableHIPRI . The problem is that after you turn on the interface, it will turn off after a while, for this reason you must execute an HTTP request every 20-30 seconds to support it. Thus, the interface will remain on.
Add a static route to the route
connectivityManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_HIPRI, ipAddressInt);
Where ipAddressInt is the address you want to connect to 3G. Routes usually go all over WiFi, so there is no problem for your GET (upload to WiFi), but you must add a route to download.
And now there are 2 problems,
- firstly, so that in this way the 3G resolved DNS resolution, you can work with the IP address, but you must have a server with a static IP address,
- Secondly, I'm not sure if it works on a specific port (this is the only idea that I have at this moment to do this ...).
Of course, you must implement another thread that supports the interface.
Ivan source share