开发者

Change android proxy settings

开发者 https://www.devze.com 2023-02-19 05:59 出处:网络
i\'m trying to write an app that can change the proxy settings on android 2.2.1 but i receive a permission exception.

i'm trying to write an app that can change the proxy settings on android 2.2.1 but i receive a permission exception.

I execute this within my code: Settings.Secure.putString(resolver,Settings.Secure.HTTP_开发者_运维知识库PROXY, "127.0.0.1:8080");

In the manifest i specified the WRITE_SETTINGS and WRITE_SECURE_SETTINGS permissions, but i receive this exception.

Permission denial: writing to secure settings requires android.permission.WRITE_SECURE_SETTINGS

I read that only system apps can change these settings directly, how can i change it.

In the apis like 2.0 is seems to work, but in 2.2 the proxy setting was moved to Secure class.


An app called APNPT changes the settings, you may want to take a peak on the code:

https://github.com/r3pek/APNpt


Please have a look at this library:

https://github.com/shouldit/android-proxy/tree/master/android-proxy-library

0

精彩评论

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