As mobile devices are created differently, there are a lot of different Screen size available in the market. Due to the small screen size, mobile application developers had always find it hard to optimize the WAP portal for different devices. Keeping a record of the screen size is also difficult as there isn’t a standard way for mobile devices manufacturers to communicate to the mobile application developers.
User Agent Profile (UAProf) specification is the answer to this problem. It is used to capture capability and preference information for mobile devices. This information can be used by content providers to produce content in an appropriate format for the specific device.
In this article, we will discuss the Perl module which use UAProf to get the screen size of the mobile devices. For further information, you can download a copy of UAProf’s specification at:
To install, do the following:
perl Makefile.PL make make install
The following a a perldoc of this module:
This module will retrieve the screen size of the device from the UAProf.
new, this method is used to create the UserAgentProfile object. initial call will be slow if the DefaultCacheDir directory is not found. If DefaultCacheDir is not found, this module will retrieve a list of UAProf from the Internet. The current list is available at here .
getSize, this method will retrieve the size of the device based on the UAProf URL. If the UAProf is not found in the DefaultCacheDir directory, this module will retrieve the UAProf from the given url. If the UAProf is found, it will retrieve from DefaultCacheDir directory.
Example of accepted value for HTTP_X_WAP_PROFILE:
http://nds1.nds.nokia.com/uaprof/N6070r100.xml "http://wap.sonyericsson.com/UAprof/K700iR201.xml", "1-bgyyJlyTUYSczJUKDdFYyw=="
You can download the package at Mobile-UserAgentProfile-0.01.tgz