Tuesday, October 31, 2017

cyanogenmod - Android USB reverse tethering: How to fool the apps


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.



Answer



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.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...