Ensure that your application provides the best possible user experience for a particular device by taking advantage of available device information. Information about a connected mobile device can be found in the HTTP User Agent and Accept headers and in the device's User Agent Profile (UAProf)—an XML document typically available on line from the manufacturer. The device capabilities information in these files enables you to provide mobile subscribers customized versions of your application. You may want to create device capability libraries to help determine the best way to serve content to various devices.
User Agent Header
The make and model of a device can be determined by the browser's user agent. See the following example.
HTTP Header: User-Agent
Example: Nokia6230i/2.0 (03.25) Profile/MIDP-2.0 Configuration/CLDC-1.1
Most device manufacturers put the make and model before the first "/", as shown in the example above for the Nokia 6230i device. Software revisions may appear after the first "/" in the user agent, and you may choose to use this information as well.
The Accept header contains a list of all content types, by MIME type, that will be supported by the device browser. See the following example.
HTTP Header: Accept
Example: application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, image/jpg, image/jpeg, image/png
This example has been truncated, but you can see that this browser supports xHTML and JPEG images, among other items.
User Agent Profile Header
The User Agent Profile is an XML document that describes the device's characteristics in more detail. Depending on your content, the Accept information may provide you with the level of detail you need. However, if you need further information, you can retrieve additional details from the device manufacturer's Web site in XML form using the UAProf header. See the following example.
HTTP Header: x-wap-profile or profile
Device Capability Libraries
You can use device capability libraries if your application is unable to use header information. These libraries may be updated and maintained without making changes to your application. To maintain your own device library, it is recommended that you keep a database of device characteristics relevant to your application. By storing the information based on the User Agent header, you can always retrieve the device-specific information you have stored with each request. Remember to stay up-to-date with the latest mobile phones on the market and keep your device library fresh with the latest information.