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.
If you are doing this much hacking I am assuming that you will probably have your device rooted. If so program a shell interface to send commands to the device shell with JNI and receive STDOUT. Use this interface to run a netcfg command that can be parsed into an array - this will give you all the details the API hides. It also allows you to override Androids device settings using the ipconfig command.
As far as using this to send and receive from your device - in my experience - you will have to probably compile a device specif module that can be loaded into the kernel at run time. Or just download the kernel from the manufacturer and compile the module into the kernel and then flash the phone with the new custom kernel.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With