!--a11y-->
Use
The device recognition process ascertains the device type and assigns the values associated with it to an instance of the implementation of the
IF_CLIENT_INFO interface.Features
Identifying a mobile device
The process of device recognition is based on the HTTP request headers "Accept" and "userAgent", which are sent to the server in the HTTP request by the requesting device. As a result of this process, the application creates an instance of the implementation of the IF_CLIENT_INFO interface.
The device recognition mechanism compares the character sequence in the "User Agent" HTTP request header – for example, Nokia7110/1.0 (04.84), (information needed to identify the device) – with the values in the configuration table MOB_DEVCFG.
If the system finds the corresponding string in the configuration table MOB_DEVCFG, an instance of the implementation of the IF_CLIENT_INFO interface is filled with the values for this device.
When evaluating the HTTP request header, the exactness with which the device is identified is taken into account. To do this, a specific priority value is assigned to each device type in the XML <priority/> tag in the configuration table.
If the priority value = 1, the character sequence matches exactly and a specific device type has been ascertained. If it cannot find a match when comparing the sequence, the device recognition mechanism tries to assign the device to a more generic device type of priority 2 or 3.
For example, if the HTTP request "userAgent" contains a sequence beginning with "Nokia", the device type is recognized as a Nokia device and the values of a NokiaGeneric device type are used to fill the instance of the ClientInfo class. The mechanism can invoke this generic device type, since developers can generally assume that a manufacturer will use the same browser for all devices.
If the device recognition mechanism cannot find any match in the MOB_DEVCFG configuration table, it can assign one of two types to the device, based on the Content Type in the HTTP request header "Accept": Either the wmlGeneric type for WAP-enabled devices or the htmlGeneric type for HTML-enabled mobile devices. In this way, the device recognition mechanism can identify a mobile device even if there is no entry for it in the configuration table.
The IF_CLIENT_INFO interface offers a range of methods that investigate the different display capabilities of different browser types.
The system fills an instance of the implementation of the IF_CLIENT_INFO interface at runtime with values, if one of its methods is called at runtime from a BSP application using an HTTP request.
The values of the device properties provided by SAP for a variety of available devices are stored in R/3 Tables on the SAP Web Application Server. Using the device type information sent in the HTTP request, the system selects the entry appropriate to the requesting device type from the table This allows the values for this device to be ascertained and entered in the instance of the ClientInfo class.
In this way, you can use the methods of the IF_CLIENT_INFO interface when you create Web applications, and thus take the characteristics of mobile devices into account.
You access the IF_CLIENT_INFO interface using the Runtime Object in the BSP application, since this allows you to access information relevant at runtime.
The following source code fragment shows how you can access the methods of the IF_CLIENT_INFO interface:
<%@page language="abap"%>
<%
...
data client_info type ref to IF_CLIENT_INFO.
client_info = runtime->client_info.
if client_info->get_title_supported( ) = ‘X’.
...
%>