Mobile Handset Detection [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this questionWhat is a good/accurate way of detecting mobile phone handsets programmatically?
Checking value of user agent is the most common way, there are couple of open source solutions that do that for you.. try Googling for them.
Here is one example: http://detectmobilebrowser.com/
And here's also one interesting solution:
http://mobiforge.com/developing/story/lightweight-device-detection-php
I can recommend WURFL for this. It's an XML file describing the capabilities of thousands of mobile devices, and combines with APIs available for .NET, Java, PHP, etc, which can recognise which device it is based on the request characteristics (primarily the user-agent header).
The web page is a bit chaotic and in sore need of an update, but the database and APIs themselves are very sound.
There are services that can do this for you. http://www.handsetdetection.com/ is one that makes it easy.
Seems like you'd have to use the User Agent string. A decent list (though not necessarily up to date) can be found here.
There are two header parameters you would need for handset detection.
- User agent - a string to identify what application or system is accessing another system.
- UAProf - a URL of RDF format which describes handset capabilities
Please refer to this simple example (Restlet):
http://shengchien.blogspot.com/2010/09/restful-mobile-detection.html
If you have User-Agent, you can use following modules, I am sharing modules for Python:
https://github.com/tobie/ua- To parse the User-Agent, you will get Vendor name and handset (tablets/Mobile phones) information. You can pass this information to the following module to get handset info.
https://handsetdetection.readme.io/v4/docs You need to login and get user id, secret key and site id from the site after logging in. Secondly, create the config file preferably yaml and set the attributes. Now you can grammatically detect as well as fetch the device info and use as you may. Thanks.
精彩评论