How to find out user-agent string for specific Android devices?

The mission is to get some statistics on some devices on the web server side. To do this, I would like to know the user-agent string for the default browsers on certain Android devices, such as:


  • HTC:
    • HTC Jetstream
    • HTC Flyer
    • HTC Evo View 4G

  • NEXUS:
    • Nexus 7
    • Nexus 10

  • SAMSUNG:
    • Galaxy Tab
    • Galaxy Tab 2
    • Galaxy Note

  • MOTOROLA:
    • Motorola Xyboard 8 "
    • Droid xyboard
    • Motorola Xyboard 10 "

Is there an easy way to find out? Is there a known list that maps the device name to the user-agent string? Also, if I have to take a different approach - please advice.

+7
source share
6 answers

I would recommend that you modify an existing solution, such as Apache Mobile Filter , which is written in perl. It uses a 51Degrees XML file with something around 70 thousand user agents. You just need to find interesting ones and modify the AMF script in such a way as to collect interesting data. Moreover, 51Degrees and AMF can also be used to determine whether a user's mobile device, screen sizes, etc.

+3
source

In my opinion, to count Hit from different User Agents based on an Android device, you have to make one URL pointing to the server. When the application starts, get the User Agent and send it to your server.

I run this code to get User Agent

WebView mes = new WebView(this); String str = mes.getSettings().getUserAgentString(); Log.i("My User Agent", str); 

In the Samsung Tablet 10.1-inch emulator, I received a user agent

 Mozilla/5.0 (Linux; U; Android 3.0; en-us; sdk Build/HONEYCOMB) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13 

and on the Nexus emulator I got

 Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; google_sdk Build/MR1) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 
+5
source

Although this is not a direct answer, I would like to address the issue:

Please note that the client-side user agent can be easily changed. For example, in the aspect of programming:

 HttpParams params = new BasicHttpParams(); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params, HTTP.UTF_8); HttpProtocolParams.setUserAgent(params, "WAHAHAHA"); HttpConnectionParams.setConnectionTimeout(params, HTTP_CONNECTION_TIMEOUT); HttpConnectionParams.setSoTimeout(params, HTTP_READ_TIMEOUT); HttpClient newHttpClient = new DefaultHttpClient(params); 

When using this HttpClient to access your site, the user agent will be "WAHAHAHA"

In addition, some web browsers available on the market, such as the dolphin browser, allow the user to enter any combination of user agent that they want.

Therefore, I think the statistics of hit statistics received from the user agent will not be so reliable, I would recommend finding another criterion for collecting information on the number of hits =]

+4
source

you can find a list of user agents here

and check them on the server

+3
source

Checkout UserAgentString.com . It also has a list of User Browser Lines for Android Webkit .

They also have an API to parse UA strings and return a list of key-value pairs or JSON.

+2
source

Create a web view and use http://developer.android.com/reference/android/webkit/WebSettings.html#getDefaultUserAgent%28android.content.Context%29 , there is no list for matching the device name with the user agent, I would suggest sending to the server, the device type and user agent by the mobile device on which your application is running.

+1
source

All Articles