By Cyker

2011-10-02 13:30:39 8 Comments

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.


@Tony Beta Lambda 2015-10-18 04:20:04

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.

@Michaël 2015-11-25 12:08:41

That is great; you should post the same answer in…

@Tony Beta Lambda 2015-11-25 12:46:06

@Michaël I think that question was marked duplicate

@Flow 2011-10-02 14:12:16

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. :)

Related Questions

Sponsored Content

6 Answered Questions

1 Answered Questions

[SOLVED] How to setup a reverse USB tethering connection (multiplatform)?

0 Answered Questions

reverse tethering - offline for some applications

0 Answered Questions

How to Reverse Usb Tethering with VPN [tun0 interface] routing?

1 Answered Questions

[SOLVED] USB connection unreliable while tethering

0 Answered Questions

0 Answered Questions

[SOLVED] Use USB as network access for an Android device (reverse tethering)?

0 Answered Questions

Internet from Ubuntu to Android via USB

0 Answered Questions

Sponsored Content