I am using Mobile Device Rules to set actions for different mobile devices. I have set two actions:
1. Change layout to one column and
2. Change theme to mobile theme displaying a block menu and the WebContent Display columns.
I need to hide portlets that are on the desktop version from the mobile version: ie. related asset portlet, ad portlets when viewing the page from a Mobile device. I need to accomplish this in the simplest way possible. Can the portlet configuration settings change to indicate whether they are displayed using a mobile device?
Found a solution to my problem, with the help of Liferay support. Two possible ways of hiding portlets:
Extend Liferay’s rendering logic: Read the http attribute and determine wheter the browser is mobile and hide the portlets you need.
For example, use a hook for render_portlet.jsp and customized using the following:
if (BrowserSnifferUtil.isMobile(request)) {
if(“1_WAR_webformportlet_INSTANCE_qlQYswM4fJFO”.equals(portletId)) { //example
supportsMobile = false;
}
}