Android HTTP User Agent

后端 未结 4 1630
生来不讨喜
生来不讨喜 2020-11-27 13:58

How do I get the real device in http_user_agent? When I use a WebView, I can get the real value like this:

[HTTP_USER_AGENT] => Mozilla/5.0(Linux; U; And         


        
4条回答
  •  佛祖请我去吃肉
    2020-11-27 14:15

    If you don't want to call setHeader() for every request you create you can set the http client parameter CoreProtocolPNames.USER_AGENT. After doing this HTTP client will automatically add this header parameter to each request.

    Something like:

    client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "Custom user agent");
    

    when you create your HttpClient.

提交回复
热议问题