The Client Information API is a set of functions intended to provide access to the client machine information, where the application is running. The 'Client machine' could be:
- A Smart Device running an App
Applications running on Smart Devices Generator usually require some information on the device such as its identification, phone number, etc.
- Browser runinng a Web application
A company provides its sales representatives with a smart device (iPhone, iPad, Android phone or tablet, etc.) to enter purchase orders, check customer information, etc. The IT department decides that no user authentication will be required except for the device identification each one has been assigned. If further authentication methods are required, GeneXus Access Manager should be used.
1. Create a Procedure object named GetClientInfo.
This procedure saves all the required identification information.
UserId = &ClientInformation.Id
UserLastConnection = Now() // Another option to insert this value is to configure the default rule with this value.
UserLastConnection = Now()
2. Define a variable of "clientInformation" type.
A typical use case is to obtain information on the device (for example, its ID or operating system) from which the client is accessing our application.
For example, in the list of a Work With for Smart Devices object we can program the following:
Note: In case the NetworkID method is used, the generator property Send Device Information on Requests must be true.
ClientInformation API Properties#
This property returns an acceptable device identifier in most implementations. Please read ClientInformation.Id Property for detailed behavior description.
||Returns the operating system name running on the SD as a string (VarChar(40)).
Returned values are: "iPad", "iPhone", "iPod", "Android" and "Blackberry".
||Returns the version of the operating system running on the Smart Devices as a string (VarChar(40)).
The returned value format depends on the operating system.
The value of this method is valid only for Smart Devices. It is used to identify a smart device that is accessing the network, and its value depends on the network technology.
A unique identifier for the device is returned, which can be IMEI, MEID, ESN or null if the device ID is not available.
The network identifier must be used only in special circumstances, because it is considered as “personal information” in some platforms. This value is not reliable when used in devices other than phones.
Note: This property is not supported in Apple Smart Devices (iOS) because it’s not possible to access this data through code (Apple doesn’t approve applications that do so).
A character string is returned with the device language.
Possible use cases: For statistical purposes, for example, to measure the number of devices accessing the application that lack the language configuration not provided by the application. In this way, priorities can be established to make the application international.
The returned string syntax is <Language>-<Region>,<Language> ; following W3C standards: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
&CharType = &ClientInformation.Language
…a possible value of &ChartType could be:
Note that the application will be automatically displayed in the language more appropriate for the user, depending on the device language and the languages available on the Knowledge Base. The GetLanguage function must be used to programmatically determine the language being used to display the application.
Returns one of the following enumerated values from SmartDeviceType domain:
iOS = 0, Android = 1, Blackberry =2, WPhone = 3
Available from X Evolution 3 Upgrade 7.