How to change Android HTTP User Agent


You can change the http client parameter (CoreProtocolPNames.USER_AGENT), After doing this HTTP client will automatically add this header parameter to each request.

private String url = "";
private String ua = "My Custom Agent";

private HttpPost post = new HttpPost(url);
post.setHeader("User-Agent", ua);

Leave a Reply

Your email address will not be published. Required fields are marked *