开发者

Is there a way to programmatically set a proxy server in my Android app?

Is there a way to programmatically set a proxy server in my Android App? I'm writing an Android App that uses some WebViews. Is there a way to set a proxy server for 开发者_如何转开发all network connections in my app, i.e. all content that is shown in the WebViews should be routed through the proxy? All other Apps on the device should not be affected by this proxy settings.


Surprisingly I don't see a mechanism listed, but maybe there is one.

Ultimately, if the webview is running in your process and implemented sensibly you can programmatically patch the existing code to route network calls through some custom code which could redirect it through a proxy (or just do whatever the proxy would), but this is very complicated low level C/assembly language programming, will require even more care to make portable across reasonable platform upgrades, and shouldn't be undertaken unless you want a very 'interesting' and educational project and you have done enough research to be sure there is no better way.


After some research I'm coming to the point that there is no (official) proxy support in Android 2.2 (and most likely also in 2.3); See this issue report with over 1000(!) comments: http://code.google.com/p/android/issues/detail?id=1273

I found some potential solutions for rooted devices, e.g. setting up some new iptables rules. I did not try any of this suggestions since I need a solution that works on any devices.


We can set the proxy in android. proxysetting 1.0 is an android app to set the proxy. Don't know further details about it. But it is clear that there is a way out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜