Android:创建代理服务器

标签 android

我如何创建一个代理服务器来监控我的 android 中的用户..

我尝试使用此代码创建代理服务器..但是没有创建..我做错了什么请说明..

public void setProxy(DefaultHttpClient httpclient) {  
    final String PROXY_IP = "127.0.0.1";  
     final int PROXY_PORT = 8080;  

     httpclient.getCredentialsProvider().setCredentials(  
             new AuthScope(PROXY_IP, PROXY_PORT),  
             new UsernamePasswordCredentials(  
                     "root", "password"));  

    HttpHost proxy = new HttpHost(PROXY_IP, PROXY_PORT);  

    httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,  
            proxy);  

}  

最佳答案

通过这种方式,您可以为应用程序的 HttpClient 配置代理。 最新版本的 Android 根本不支持系统范围的代理。检查此以获取更多详细信息:How to set system wide proxy in ICS

关于Android:创建代理服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14973980/

相关文章:

android - 通过 JSoup 在 WebView 中仅获取一个 Div(按类)

android - 开发人员有效载荷

java - Retrofit API Post 调用返回错误 500,与 Postman 配合良好

java - 无法使用自定义适配器单击 listview android

android - 谷歌分析 EasyTracker v2 配置

java - Android线性加速,计算轨迹

android - 如何在android中为Textview设置自动刷新?

java - 使用 OpenVPN 创建 VPN

android - Android 应用程序是否向后兼容?

java - ListView 未显示/出现 android studio