Configuring mobile development
Enabling device profiles
Device profiles allow you to customize the layout and content of pages according to the devices that visitors use to view pages. To start using device profiles, enable the feature in the settings:
- Open the Settings application.
- Navigate to the Content -> Content management category.
- (Optional) Select a site where you want to enable device profiles.
- In the Mobile development section, select the Enable device profiles checkbox.
- Click Save.
With device profiles enabled, the system evaluates whether the device that is requesting a page belongs to one of the device profiles defined in the Device profiles application.
Setting up device detection
By default, Kentico only detects a limited set of mobile devices. The basic detection uses XML data stored in the ~/App_Data/CMSModules/DeviceProfile/devices.xml file, which contains information about specific devices.
Each device has a set of properties describing its capabilities and a list of user agents used for identification. For example:
<Device name="Nokia_710" displayname="Nokia - 710" width="480" height="800" mobile="true">
<UserAgent>
Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 710)
</UserAgent>
<UserAgent>
Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; 710)
</UserAgent>
</Device>
You can manually expand the data by adding devices and their user agents. The system reloads the data when the application starts, so you need to restart the application for changes to take effect (open the System application, click Restart application).
When creating device profiles, you can assign the devices from the XML file using the device selector.
Using 51degrees.mobi device data
The 51degrees.mobi mobile device detection software integrated into Kentico allows you to extend the detection data to include all devices that are available on the market. The data also provides access to all device properties (listed in Device macros).
To use the data, you need to obtain a license from 51degrees.mobi and register it within Kentico:
Buy a license for Premium Data at 51degrees.mobi at http://51degrees.mobi/.
- You will receive either a license key that enables you to download device data automatically, or a data file that you need to manually upload into the system.
51Degrees API version
Kentico 8.2 uses version 3.1.2.3 of the 51Degrees API. When obtaining device data files, the data file version must match the API version – V3.1.
- Open the Settings application.
- Select the Integration -> 51Degrees.mobi category.
- Enter your 51degrees.mobi license key into the text box and click Activate, or select a data file from your disk and click Upload.
- Click Save.
The system now has access to the 51degrees.mobi mobile device data set. You can select devices directly from the device selector when creating device profiles and you can access additional device properties within the CurrentDevice macro object.
Disabling the 51Degrees.mobi device detection
The 51Degrees.mobi device detection is enabled by default. If you plan on not using the device detection software at all, you can consider disabling it completely. This also frees up some of the server’s memory resources.
Open your project’s web.config file.
In the <appSettings> section of the file, add the following key:
<add key="CMSEnable51D" value="false" />
Save the web.config file.
The 51Degrees.mobi device detection software is now disabled.