Retrieve User-Agent programmatically

If you don’t have one you can try taking it like this

String ua=new WebView(this).getSettings().getUserAgentString();

Edit-

The doc for getUserAgentString() says

Return the WebView’s user-agent string.

So i don’t think you can get it unless you declare one. Some one correct me if i am wrong

Leave a Comment