Creating Mobile Device Rules

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,

  1. Open the Product Menu.

  2. Use the Site Selector (Site Selector) to choose the Site that you want to define Mobile Device Rules for.

  3. Select ConfigurationMobile Device Families.

You can also add families for all Sites by navigating to the Control Panel → SitesGlobal. 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.

  1. Click Add button (Add Family) to add a New Device Family.

  2. Enter a Name and Description.

  3. Click Save.

  4. 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.

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.

  1. Click on the Add button (Add Classification Rule) to add a new rule.

  2. Enter a Name and Description.

  3. Select the classifications you want for this rule from Operating System and Type, Physical Screen Size, and Screen Resolution.

  4. 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.

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:

  1. Go to BuildPages in your Site.

  2. Click on Configuration (Configure) for the Public Pages.

  3. Select the Advanced tab and open the Mobile Device Rules option in the bottom menu.

  4. 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 ConfigurationSite 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.

Figure 3: You can select a mobile device family to apply for a Site or page.

« Mobile Device RulesMobile Device Actions »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0