Hans Petter Naumann
Hans Petter Naumann

Reputation: 801

Detecting mobile device manufacturer based on user agent string

Is there an easy way of detecting a phone/tablet's manufacturer from a user agent string? I have not found any sources on characteristics on each manufacturers strings, and I assume there can be examples of i.e samsung devices where "samsung" is not a part of the string, but I might be wrong about that.

I've taken notice to WURFL, but thats just too overkill for my needs.

For what its worth, I'm working in a .Net 3.5 environment.

Upvotes: 1

Views: 948

Answers (1)

Tom Grant
Tom Grant

Reputation: 2045

As you correctly pointed out, the problem with parsing user agents for information like that is that there is no guarantee on what information is included in the user-agent. Additionally, different apps will use different codes for the information they want in the user agent.

As an example, I've been looking into user agents and some are just empty strings, so you don't even know the app that made the request (unless can be deduced from domain etc.).

A simple naive approach is to parse the user agent string for strings like "iPhone", "samsung", "htc" etc. However, as indicated above this won't work all the time, however, it will work for browser user agents (there's quite a bit of information about these around).

Upvotes: 1

Related Questions