18

USB reverse tethering = Cellphone gets network connection from PC via USB.

I know how to do USB reverse tethering except for one problem: Many Android apps will check network connection using the code below before doing any useful work:

ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = connectivityManager.getActiveNetworkInfo();

The problem is that, when using USB reverse tethering, the above code will report no network connection. However, there IS a network connection (which is the USB reverse tethering itself), and ping, wget and all programs not doing this stupid check work well.

So the question is: How can I hack the system to let this network connection check return success (so that I can fool these apps)?

BTW. I use Cyanogenmod 7. And any solution specific to this MOD is also welcome.

2

2 Answers 2

5

I see that this is a rather old question but in case someone googled and got here. There is a fairly new module called FakeWifiConnection based on Xposed framework. The installation and usage should be quite straightforward.

2
9

I'd say that there are only Mod specific solutions. Nearly every App that I know uses this Android API, and therefore the code snipped in your questions, for network connectivity checks.

One would need to change the Cyanogen source so that the OS (Android+Cyanogen) is aware of the USB reverse tethering network connectivity and returns the right information to app requesting the current network state. I don't believe that this can be done with some artificial layer between the API and the app that "fools" the app into this. It's more realistic that Cyanogen implements the handling of reverse tethering by imitating an active WiFi connection. You should ask them to address this topic. Maybe in the future Android has official support for reverse tethering. :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .