Reputation: 1599
I am using httpClient to send a request from my android app to my web server and trying to take user-agent in my servlet. But am getting 'Apache-HttpClient/UNAVAILABLE (java 1.4)'. How to know this request is from android app? Kindly suggest to resolve this?
Upvotes: 0
Views: 397
Reputation: 161
Use this code for android default user agent. httpclient.getParams().setParameter(CoreProtocolPNames.USER_AGENT,System.getProperty("http.agent"));
Upvotes: 1
Reputation: 1859
Well, this is the default User Agent. But you can set a custom user agent like this:
client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "Custom user agent");
Upvotes: 0