0

I have RESTful web service and mobile clients (applications)for Android, iOS, WinPhone 8 and BlackBerry. Interaction with the server is implemented by sending http requests with parameters to the server. And I wonder can I in some way determine OS type from which this request was sent (by http content or something else)? I know i can add specific field as a parameter to the request but I don't like such a solution. I know there is a way to determine an OS type via mobile browser. May be similar idea can be used for my mobile applications or each mobile OS add some specific information to the http request or whatever. Thanks in advance!

MainstreamDeveloper00
  • 8,056
  • 13
  • 52
  • 100

2 Answers2

1

It depends on the HTTP package you are using for the requests. For instance, on Android you are probably using Apache and that has this default user agent:

"Apache-HttpClient/UNAVAILABLE..."

You can check other platforms to see their default user agent as well.

But personally I think this is a bad solution. its best if you manually set the user agent per device, (or add another parameter to the request, although you seem to dislike it :)

btw - ignore the answers on mobile browser user agent as they are irrelevant for your case.

yarons
  • 284
  • 2
  • 3
0

Take a look at the user-agent in the HTTP header. Quoting Wikipedia:

The components of this string are as follows:

  • Mozilla/5.0: Previously used to indicate compatibility with the Mozilla rendering engine
  • (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us): Details of the system in which the browser is running
  • AppleWebKit/531.21.10: The platform the browser uses
  • (KHTML, like Gecko): Browser platform details
  • Mobile/7B405: This is used by the browser to indicate specific enhancements that are available directly in the browser or through third parties. An example of this is Microsoft Live Meeting which registers an extension so that the Live Meeting service knows if the software is already installed, which means it can provide a streamlined experience to joining meetings.
Community
  • 1
  • 1
thegrinner
  • 9,633
  • 5
  • 39
  • 64