To configure mobile device rules, you need a way to find out the characteristics of the device. While some of the characteristics are provided by the device, most are not. For this reason, there are databases that contain information about thousands of devices. These databases make it possible to learn every detail about a device from the device type. Liferay DXP’s Mobile Device Rules can connect to device databases so that you can use their device characteristics in your rules.
You can develop plugins that integrate with other device databases. Even if you don’t have a device database, you can still set up mobile device rules. They won’t, however, be effective until a database is deployed, because the portal won’t have enough information about the devices being used to make page requests.
To access the Mobile Device Families administrative page,
-
Open the Product Menu.
-
Use the Site Selector (
) to choose the Site that you want to define Mobile Device Rules for.
-
Select Configuration → Mobile Device Families.
You can also add families for all Sites by navigating to the Control Panel → Sites → Global. The Mobile Device Families administrative page displays a list of defined families and lets you add more. To add rules, you must first add a family.
-
Click Add button (
) to add a New Device Family.
-
Enter a Name and Description.
-
Click Save.
-
Click on the name of the Mobile Device Family to access the rules page.
Figure 1: Create a Mobile Device Family so you can create rules.
The rules defined for a family, along with the priorities of the families selected for a particular Site or page, determine which family’s actions are applied to a given request. From the New Classification Rule page for a specific rule set, you can add a rule by specifying an operating system, rule type, physical screen size, and screen resolution. Remember that you can add as many rules to a family as you need in order to classify the devices on which you’d like to take actions.
-
Click on the Add button (
) to add a new rule.
-
Enter a Name and Description.
-
Select the classifications you want for this rule from Operating System and Type, Physical Screen Size, and Screen Resolution.
-
Click Save.
You’ll notice after saving the classification rule that it’s characterized as a Simple Rule. Only Simple Rules are included with Liferay DXP, but the rules are designed to be extensible, and additional rule types can be added by your developers.
Figure 2: Select the operating system and device type for your rule.
Once you’ve created some mobile device families and added some rules to them, you’re ready to create some actions. The actions defined for a family determine what happens to a request when the device is detected and the family has been found to apply.
You can add families to a Site, individual page, or page set from their respective configuration pages. To do it for a Page Set:
-
Go to Build → Pages in your Site.
-
Click on Configuration (
) for the Public Pages.
-
Select the Advanced tab and open the Mobile Device Rules option in the bottom menu.
-
Click Select to open the list of families that can be applied.
From the same page, you can access the configuration for an individual page, or you can configure Mobile Device Rules for an entire Site from Configuration → Site Settings. You can select multiple families for a particular Site or page and order them by priority. The families are checked in decreasing order of priority: the actions defined by the first family that applies are executed.
Figure 3: You can select a mobile device family to apply for a Site or page.