standard java vm proxy_Android's proxy confusing documentation resour

It seems to me that there is a lot of confusing resources regarding the proxy topic on Android.

First of all, it seems that all the methods of the Proxy class are declared deprecated and it's suggested to:

"Use standard java vm proxy values to find the host, port and

exclusion list. This call ignores the exclusion list."

The official java vm proxy values can be accessed in the following way:

System.getProperty("http.proxyHost")

System.getProperty("http.proxyPort")

System.getProperty("http.nonProxyHosts")

This could seem confirmed by the documentation of the ProxySelector class.

But trying on a real device or an emulator, these values seems to me always empty. After looking to the Android source code of the hidden ProxySelector activity, it seems that the proxy is saved into the secure settings of the system in the following way:

Settings.Secure.putString(res, Settings.Secure.HTTP_PROXY, hostname);

And only an application signed by the OS provider can write to the secure settings. Developers can access these settings only in read mode in the following way:

Settings.Secure.getString(getApplicationContext().getContentResolver(),Settings.Secure.HTTP_PROXY);

Someone can clarify if this is the correct reading of how can be access the proxy settings into Android? (At least it seems to work). If this is the correct intepretation, why the documentation is so full of errors?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值