Mobile device detection in Liferay 6.1

| 5 Comments | No TrackBacks |

I'm still getting a lot of questions about how to use the multi-device extension in Liferay 6.1. The answer is, you don't have to. The code was contributed to Liferay and it's now available OOTB in Liferay 6.1.

The following comparison table will give you a better idea of what went where:

 Feature Liferay 6.0  Liferay 6.1
look and feel change logic, generic data model and "extension points" for other plug-ins. multi-device-ext plugin integrated into Liferay's core. No need to install additional plug-in
Device recognition based on WURFL wurfl-web 6.0.5.x plugin (does not contain WURFLD DB) wurfl-web 6.1.0.x (available under AGPL license, due to the fact WURFL itself switched to AGPL, as part of Liferay's official plug-ins. It contains the WURFL's database!)
Building device rules and applying actions to matched rules device-rules-hook-6.0.5.x plugin Integrated into Liferay's core. No need to install additional plug-in (Provides somewhat different approach for managing rules and rule groups. Rules conditions simplified/limited to OS chooser and "is tablet" combo box.)

 

 

 So, to use device detection in Liferay 6.1, all you need to do is download and install the official wurfl-web plugin. 

 

If you get exception like this :

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder
for further details.
Exception in thread "liferay
/hot_deploy-1" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261)
at net.sourceforge.wurfl.core.resource.XMLResource.<clinit>(XMLResource.java:59)
at com.liferay
.portal.mobile.device.wurfl.WURFLHolderImpl.getWURFLDatabase(WURFLHolderImpl.java:140)
at com.liferay
.portal.mobile.device.wurfl.WURFLHolderImpl.initialize(WURFLHolderImpl.java:73)
at com.liferay
.portal.mobile.device.wurfl.messaging.WURFLDeploymentMessageListener.doReceive(WURFLDeploymentMessageListener.java:52)
at com.liferay
.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:25)
at com.liferay
.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:65)
at com.liferay
.portal.kernel.messaging.SerialDestination$1.run(SerialDestination.java:101)
at com.liferay
.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:669)
at com.liferay
.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:580)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
... 16 more

Then:
  • download slf4j from http://www.slf4j.org/download.html
  • unzip it and copy slf4j-log4j12.jar to <LIFERAY_HOME>/tomcat-7.0.23/webapps/wurfl-web/WEB-INF/lib folder
  • restart Liferay
 

Once you have this installed you can go ahead and define your rules. The following video demonstrates how:

 

No TrackBacks

TrackBack URL: http://milen.commsen.com/cgi-bin/mt5/mt-tb.cgi/26

5 Comments

I did exact sameway you described but it is not recognizing my mobile device and not applying rules.
62qcge

How can I add a custom action to the Mobile Detection plugin? I wan to hide a few portlets or column from the page if a mobile device is detected.

Thank you.

Hi,
I have the same problem, Mani, could you solve it? I wrote a message in the liferay forum, but I have not recived an answer yet.

I'm trying to test wurfl-web with the firefox plugin "User agent switcher".

I am using:
wurfl-web-6.1.0.1-ce-ga1-20120106155615760
firefox 13.0.1
User Agent Switcher 0.7.3
liferay-portal-6.1.0-ce-ga1

Leave a comment

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.01