问题
For my App I need Data from both, a local Network and the Internet. The local Network (Wifi) has no connection to the internet so I have to use the mobile connection (3G for Example).
But whenever I connect to the local Network, 3G stopps. After asking the Samsung Service, there is no way to change that in the UI. But they couldn't tell me, if there is a programmable Interface for that.
There is a mobile access point inside, so there is a way to connect a Wifi device to the Internet (which means that both, a wifi and a 3G connection is possible the same time in that way). But for my App the phone/tab has to connect to the existing Network and use the 3G for Internet.
So this is my question here.
Is there a way to connect to an existing Network and using 3G for Internet the same time?
回答1:
I've looked at the code used by Android WiFi Tether. I think that will be of great help for your work. Click here
What it does is load the WiFi module once 3G is turned on. Then it use iwconfig/ifconfig to configure the interfaces and run it. They further make appropriate changes to the routing table to ensure tethering. You could make changes to routing options to suit your requirements.
Update: I worked on the approach I mentioned here. Please find my progress on this link
Bottomline is that it is possible to use both 3G and WiFi concurrently on Android Phones.
回答2:
It doesn't seem to be possible according to this thread: http://groups.google.com/group/android-developers/browse_thread/thread/a2a0e72b170dfb53
回答3:
Would connecting to one network and then the other sequentially be sufficient? You can pragmatically turn wifi on and off if you include the right permissions. See How to use 3G Connection in Android Application instead of Wi-fi? for specifics.
来源:https://stackoverflow.com/questions/5497553/wifi-and-3g-same-time