Appending the User Agent String
To facilitate tracking of client access on the server and to enable your Fiori infrastructure to enable or disable features depending on the client, you can configure the SAP Fiori Client to append a custom string to the beginning of the user-agent string delivered to a web server with any HTTP request sent by the client.
Because the user-agent string can only be set on startup for iOS, you cannot make this change in the application’s code; instead it must be made to the Cordova project’s config.xml file.
Navigate to the folder where the script created the SAP Fiori Client application and look for the config.xml file there. The default folder name for the project is FioriClient, so on Windows the file is in C:\SAP\MobileSDK3\KapselSDK\app\Fiori\FioriClient. On Macintosh OS X, the file is in the SDK installation folder’s /KapselSDK/app/Fiori/FioriClient folder.
To define the string that is appended to any HTTP request’s user-agent string, add the following string to the application’s config.xml, replacing USER-AGENT-STRING-VALUE with the value you want appended to the user-agent string:
<preference name="UserAgentPrefix" value="USER-AGENT-STRING-VALUE"/>
An example of a modified config.xml is shown below:
<?xml version='1.0' encoding='utf-8'?> <widget id="com.company.fiori" version="0.0.1" xmlns=http://www.w3.org/ns/widgets xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>Fiori Client</name> <description>Fiori Client Application.</description> <author email="dev@company.com" href="http://company.com"> Some Developer</author> <content src="index.html" /> <access origin="*" /> <preference name="UserAgentPrefix" value="Fiori Client"/> </widget>
Be sure to add the preference element to the file within the widget element as shown in the example.