Mobile phone detection (brand, model, browser etc)

32,057

Solution 1

OMG, are you really keeping your own database up to date? I'm so sorry about you...

First tip: If you only need a very simple and minimal solution to detect brand and model, go with WURFL if you want it for free or DeviceAtlas if you can afford it. The second one probably works better (just my personal opinion).

Also, take a look at this comparision DeviceAtlas vs WURFL.

Second tip: As a general rule, it is a good idea to stay tuned with the W3C standards. In that sense, the DDR Simple API (Device Description Repository Simple API) is the way to go. It describes an abstract API to access Device Description Repositories (DDRs).

You can find an open-source reference implementation of that API in Java as part of MyMobileWeb project (dead link). It allows you to access WURFL, DeviceAtlas (not 100% sure), W3C DDR Core Vocabulary (and maybe UAProf). This way you can access device properties with a unified API, that is also offered as a REST service (see DDR REST service documentation, dead link).

You can download (dead link) the latest 1.2 version. I know they are working in a new version that could probably be released by october and a Rails implementation.

What that means, in practice, is that you can develop your application using WURFL and later switch to another repository, keeping your code ideally untouched. It is harder to install and use for the first time, but if you are building a big enterprise system, you'll save a lot of time in the future.

I have to say I've previously worked on that project, I think it's worth a look in any case, despite W3C standards are usually hard to read. Maybe there are other alternative implementacions of the DDR Simple API out there.

Solution 2

This is not a direct answer, but I believe a valuable contribution. Of course applicability is dependent on your requirements, but I think many readers developing for consumers will find it useful and relevant.

To such a fine degree, I don't.

Of course, user-agent detection is great to serve an optimized mobile version for devices with good, standards-based browsers, such as Android phones, iPhone/iPod Touch, etc.

For practical purposes, "old school" mobile browsers are dead. Devices that people actually use the mobile web on today have great, capable browsers: WebKit, Opera, and Firefox Mobile. RIM just announced a built-in WebKit browser, and I feel they're the last major player to make the migration.

I've assumed your goal is simply redirection to a mobile website. If it's more complex, for instance, logging individual model numbers or tracking fine-grain statistics, these posts from Stack Overflow should prove helpful:

Solution 3

Also check out Mobile Device Database File (MDBF) from Microsoft. Even though it has stopped being updated, it at least contains many many years of devices up to recently.

Solution 4

Luca Passani, WURFL inventor here. My company recently launched this service which pretty much soves the problem discussed here free of charge. I advise you check out http://wurfl.io/

In a nutshell, if you import a tiny JS file:

<script type='text/javascript' src="//wurfl.io/wurfl.js"></script>

you will be left with a JSON object that looks like:

{
 "complete_device_name":"Google Nexus 7",
 "is_mobile":true,
 "form_factor":"Tablet"
}

(that's assuming you are using a Nexus 7, of course) and you will be able to do things like:

if(WURFL.form_factor == "Tablet"){
    //dostuff();
}

Or

modelName = WURFL.complete_device_name 

This is what you are looking for.

Thanks

Share:
32,057

Related videos on Youtube

ariddell
Author by

ariddell

Seeking knowledge.

Updated on September 17, 2022

Comments

  • ariddell
    ariddell over 1 year

    What do you use to detect visitor's mobile phone, down to the model if possible?

    Currently we maintain our own database but it's really getting behind due to lack of manpower to maintain it, so we decided to give 3rd party solution a try.

    These are my candidates but I don't have time to really try them all:

    • DeviceAtlas - 1 year personal evaluation, but basic license is affordable. Their database look solid with daily update and user-contributed tests / updates. I am favoring this one at the moment.

    • DetectRight - I was recommended this by a colleague but really can't find much from their site. 20k devices -- really?

    • WURFL - Open source, database collaboratively derived from UAProf. So basically if you're going with UAProf solution, you're better off with WURFL.

    • DetectMoBileBrowsers - This looks like the simplest of all. Too bad it's language dependent (PHP).

    Please share your experience or suggestions!

    • Admin
      Admin over 2 years
      I've locked this question as off-topic, because it asks for recommendations for external websites or tools.
  • ariddell
    ariddell over 13 years
    Well when what I do is only mobile sites... I have to know the breakdown of models etc to know where to prioritize.
  • ariddell
    ariddell over 13 years
    I like your second tip, thanks! Will check it out when I have time.