I want to use the default user agent for the phone in a HttpClient connection and would like to know if there is a way to obtain the user agent without having to have a WebView to query.
Very late answer, for others that may be looking for this.
I was looking for a way to obtain the user agent string used by HttpUrlConnection, to use it with HttpClient and amend it with my own version info. This way, my Android app provides some useful version info I can extract from the server's log files (Android Version, device name/type, and the version of my app).
For example, the user agent string for my phone when using HttpUrlConnection looks like this:
Dalvik/1.4.0 (Linux; U; Android 2.3.5; HTC Desire HD A9191 Build/GRJ90)
This string can be obtained from system properties like so:
String userAgent = System.getProperty( "http.agent" );