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:

Go to the Configuration page for the page, page set, or Site where you
have configured a device family.

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

Click Add Action.

Figure 1: 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.

Tip: Liferay DXP 7.1 was designed from the ground up to be responsive and
adapt to any device that might be accessing it. Before creating new themes or
forcing a layout template change, you should test how the Site behaves using
Liferay DXP out of the box. Certain features, like URL Redirects, can be
disruptive and frustrating for users if used improperly.

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:

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

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

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.

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

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 or iOS tablet,
a different layout is used. To set this up, you must follow the same four steps
described above.

First create the Mobile Device Family:

Navigate to the Mobile Device Families page of Site Administration.

Click Add Device Family ().

Enter Android and iOS Tablets for the Name.

Click Save.

Next create a rule for the family:

From the Mobile Device Families page, click on Android and iOS Tablets.

Click Add Classification Rule ().

Name the rule Rule 1.

Under Operating System select Android and iPhone OS (you can hold
or to select multiple items).

Under Device Type select Tablets,

Click Save.

Figure 2: 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.

Now the Liferay Site’s pages are presented to Android and iOS tablet 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.