简体   繁体   中英

Android:create a proxy server

How can i create a proxy server to monitor my users in my android..

I tried to create proxy server using this code ..But that not getting created..Did i do anything wrong in that please state..

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);  

}  

In this way you are configuring proxy for your application's HttpClient. Recent versions of Android do not support system-wide proxy at all. Check this for some more details: How to set system wide proxy in ICS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM