8

The mission is to get some statistics on some of the devices at the web-server side. For that, I would like to know the user-agent string for default browsers on specific 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 know it? Is there a well-known list that maps device name to user-agent string? Also, if I should take a different approach - please advice.

7
  • The useragent is not unique to devices Commented Dec 25, 2012 at 16:04
  • Please explain. Anyways, the mission is to get some statistics on some of the devices above (and some others) from the web-server side. Any advice on that will be helpful. Commented Dec 25, 2012 at 16:05
  • 3
    Different devices can have the same useragent. They can even report false user agents. It's completely upto the app making the request. What statistics are you looking for? Commented Dec 25, 2012 at 16:07
  • @RaghavSood I have a db of user-agent strings, need to pull the statistics from it (assuming that the devices are not modifying their user-agent strings on purpose) Commented Dec 25, 2012 at 16:16
  • Yes, but what statistics? Commented Dec 25, 2012 at 16:17

6 Answers 6

6

In my opinion to count the Hit from various User Agent on base of Android Device you should make one URL pointing to server. In the starting of application get User Agent and send 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); 

On Samsung Tablet 10.1 inch emulator i got 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 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 
Sign up to request clarification or add additional context in comments.

Comments

4

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

Please note that user-agent in client side can be modified easily. For example in programming aspect:

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 in market such as dolphin browser allows user to input any user agent combination they want.

Therefore what i think is the hit count statistic collected from the user agent will be not so reliable, I would recommend to find another criteria to collect the hit count information =]

1 Comment

Yes, all HTTP request headers are generated by the (potentially untrusted) client. However, only a very small percentage of users modify their user-agent string, so for practical purposes these statistical outliers will not have a noticeable effect on the results that the OP is seeking.
3
+50

I would recommend you to modify an existing solution such as Apache Mobile Filter which is written in perl. It uses 51Degrees XML file with something about 70k user agents. You simply would have to find interesting ones and modify AMF script in such way that it would collect interesting data. What is more 51Degrees and AMF might be used also to recognize whether the user's device is mobile, it's screen dimensions etc.

Comments

3

you can find a list of the user agents here

and check them on the server

3 Comments

Great! How do I know the user agent string for Galaxy Tab 2 for example?
it depend on your server-side language.. So, you can search how to get the user agent and parse it for that certain language.
Which string should I search for Galaxy Tab 2 (for example)?
2

Checkout UserAgentString.com. It also has a list of Android Webkit Browser User Agent Strings.

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

Comments

1

Create a Webview and use http://developer.android.com/reference/android/webkit/WebSettings.html#getDefaultUserAgent%28android.content.Context%29, there is no list to map the device name to the user agent, by i would suggest to send to server the Device type and the user agent by the mobile running your application.

1 Comment

I have an array of user-agent strings on the server side. Now I want to count the hits from different devices.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.