Mobile Device Actions

After you’ve created families and applied rules to define those families, you can associate specific actions that occur when a user visits that Site on a device.

To add actions to a selected rule group:

  1. Click Configure (Configure) for the page, page set, or Site where you have configured a device family. The configuration page appears.

  2. Click the Advanced tab.

  3. Decline using the same mobile device rules from the public pages by setting the option to No. The device family section appears.

    Figure 1: Disable using public pages device rules.

    Figure 1: Disable using public pages device rules.

  4. Click Select to open the Device Families page.

  5. In the Mobile Device Rules section, click Actions (Actions) → Manage Actions next to the device family that you wish to add an action for.

  6. Click Add Action.

Figure 2: Getting to the Manage Actions page.

Figure 2: Getting to the Manage Actions page.

By default, there are four kinds of actions that can be configured for mobile families:

Layout Template Modification: Changes the way portlets are arranged on pages delivered to mobile devices. For example, you could have pages with more complex layouts automatically switch to a simpler template if it detects a mobile device—even if the resolution is theoretically high enough to support the standard layout.

Theme Modification: Selects a specific theme for different mobile device families. You’d have to have a mobile version of your Site’s theme that is automatically applied when a device hits your page.

URL Redirect: Sends mobile users to any URL. This can be used to direct mobile users to a mobile app download or a mobile version of the page.

Site Redirect: Sends mobile users to a different Site on your portal. In some cases, mobile content could be created on a mirror of your Site.

Like mobile device rules, mobile device actions are extensible. Your developers can define custom actions in addition to the four actions provided by default.

To review, if you want to configure an action or actions that take place when mobile device requests are received, take the following steps:

  1. Create a mobile device family to represent the group of devices for which to define an action or actions.

  2. Define one or more rules for your family that describe the group of devices represented by your family.

  3. Apply your family to an entire page set of a Site (all the public pages of a Site or all the private pages) or to a single page.

  4. Define one or more actions for your family that describe how requests should be handled.

Mobile Device Rules Example

Now you’ll look at an example of using mobile device rules. Suppose you want to create a rule so that when a Site is accessed by an Android device, a different layout is used. To set this up, you must follow the same four steps described above.

First create the Mobile Device Family:

  1. Navigate to the Mobile Device Families page of Site Administration.

  2. Click Add Device Family (Add Device Family).

  3. Enter Android for the Name.

  4. Click Save.

Next create a rule for the family:

  1. From the Mobile Device Families page, click on Android.

  2. Click Add Classification Rule (Add Classification Rule).

  3. Name the rule Rule 1.

  4. Under Operating System select Android (you can hold or to select multiple items).

  5. Under Device Type select All,

  6. Click Save.

    Figure 3: Create the Classification rule.

    Figure 3: Create the Classification rule.

As with the previous example, you only need one rule to describe your device family. Now you must apply the rule to some pages.

  1. Go to Site BuilderPages in Site Administration.

  2. Click on the Configure icon for the Public Pages

  3. Go to the Advanced tab.

  4. Under Mobile Device Rules, select the Android device family.

Now you must define an action for your Android rule group to use a different layout.

  1. Click ActionsManage Actions for the Android rule.

  2. Click Add Action.

  3. Enter the name Layout Template Modification, and select the Layout Template Modification action type.

  4. Select the 1 Column layout template.

  5. Click Save.

Figure 4: Create the Actions for Android.

Figure 4: Create the Actions for Android.

Now the Liferay Site’s pages are presented to Android users with the 1 Column layout template.

Mobile Device Rules are a powerful way to manage the way pages and content appear on the various devices that access your Site. But remember to consider the power of modern devices and the experience of your users, and use this great power responsibly—to help users have a great experience on your website and to not interrupt or negatively impact that experience on whatever device they’re using.

« Creating Mobile Device RulesUsing Full Page Applications »
Was this article helpful?
0 out of 0 found this helpful