Aju Aju - 1 year ago 139
Android Question

Api call in app is getting bypassed from the charles proxy

My App is developed using Xamarin.Android. When I try to do API debugging using Charles, I am not able to see the APIs in Charles. But I can see APIs of the other Apps installed in my device.

I have set the proxy in the android device taking IP from my system.

Here is the code which I have used in the PCL code, which is used for both IOS and Android.

return new HttpClient(new AuthenticatedHttpClientHandler(new NativeMessageHandler()))
BaseAddress = new Uri(baseUrl),
Timeout = new TimeSpan(0, 0, timeout)

public class AuthenticatedHttpClientHandler : DelegatingHandler
public AuthenticatedHttpClientHandler(HttpMessageHandler innerHandler) : base(innerHandler)
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)

Proxy is working for IOS.

Answer Source

The Mono HttpClient isn't using the proxy settings. Configure your app to use the native ClientHandler.


  • add a file to your project
  • insert XA_HTTP_CLIENT_HANDLER_TYPE=Xamarin.Android.Net.AndroidClientHandler
  • set Build Action to AndroidEnvironment

enter image description here

or create your HttpClient like:

var client = new HttpClient (new Xamarin.Android.Net.AndroidClientHandler ());
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download