Showing posts with label Fiddler. Show all posts
Showing posts with label Fiddler. Show all posts

Sunday, June 16, 2013

Setting up the Android Emulator for HTTP debugging using Fiddler2

Launch an emulator with parameters:

emulator -avd my_avd -http-proxy 127.0.0.1:8888

http://www.android-proxy.com/2011/11/may-force-be-with-you-use.html

Finding proxy:

DefaultHttpClient httpclient = new DefaultHttpClient();

String proxyString = Settings.Secure.getString(getApplicationContext().getContentResolver(), Settings.Secure.HTTP_PROXY);

if (proxyString != null)
{   
    String proxyAddress = proxyString.split(":")[0];
    int proxyPort = Integer.parseInt(proxyString.split(":")[1]);
    HttpHost proxy = new HttpHost(proxyAddress, proxyPort);

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

Powered by Blogger.