Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

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.

share|improve this question
    
This question is addresses the same problem as android.stackexchange.com/questions/11728/… –  Flow Oct 2 '11 at 14:14

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.