Android proxy wifi vs mobile [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 02:50:15

问题


I know it is a mess when it comes to proxy support in Android and a lot of frustration too. I read most of posts on SO and I am still confused.

I would like to support both Wifi proxy and mobile proxy and I know that there has been some changes in proxy support prior to honeycomb and post honeycomb. I also read that you need to be a system app to set proxy even if you have the android.permission.WRITE_SECURE_SETTINGS permission.

So can i set system proxy for wifi and mobile network from my application? Any difference before honeycomb and after honeycomb?

What's the preferred way to get proxy settings for wifi and mobile network? Any difference before honeycomb and after? If I want to use it in my app, is it simple as setting proxy parameter on the httpClient object? Anything else I need to do? Or should I use system property?

Please consider the case where Wifi and mobile proxy could be different.

Any pointer to a good document on this (updated to reflect changes since honeycomb) would be very helpful. I did not find any good ones.


回答1:


With reflection you can get the proxy settings for each Wi-Fi access point. It's what this library does. You can use it to easily access the proxy settings for the current configuration.




回答2:


So can i set system proxy for wifi and mobile network from my application?

No, unless your app is part of the firmware.

Any difference before honeycomb and after honeycomb?

Not with respect to whether or not you can set them.

What's the preferred way to get proxy settings for wifi and mobile network?

AFAIK, there is only one accessible proxy setting, Settings.Secure.HTTP_PROXY, which you get via a call to getString() on Settings.Secure.

Any difference before honeycomb and after?

Not that I am aware of.



来源:https://stackoverflow.com/questions/9139080/android-proxy-wifi-vs-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!