Upgrade WURFL's database into Liferay Mobile Device Detection Lite 

Introduction

If you're reading this post is because you need to know which device currently access on your Liferay through Liferay Mobile Device Detection Lite. Specially, you can not explain why Liferay detects a different version of your modern, cool and super updated device!

Don't worry! I try to explain you what to do.

WURFL's database

Before to explain,  do you know the WURLF's database? If you don't, you can see this shortly video!

In order to detect your device, you already know to download and install the Liferay Mobile Device Detection Lite from marketplace

This app contain a WURLF's database prepopulated inside the bundle through an external service called 51Degrees. This database is populated only during the build of bundle and not at runtime.

processResources {
	into("META-INF") {
		from {
			FileUtil.get(project, "https://github.com/51Degrees/Device-Detection/raw/master/data/51Degrees-LiteV3.2.dat")
		}
	}
}

code from build.gradle of this app

The result was a 51Degrees.dat file inside the META-INF folder and, as you can image, this file is the engine of the device detection process.

Currently the last release (build) of Liferay Mobile Device Detection Lite was one year ago on marketplace and now the devices data are very old.

How to upgrade this WURFL's database

You can see, on the following image, the configuration of Liferay Mobile Device Detection Lite (51Degrees Device Detection) and how is linked the WURLF's database.

Unfortunately this configuration check on file system only inside your bundle and we can't link an URL or set an absolute path of this data file put in other places.

The only way to add or replace files inside existing bundle is a fragment. Now we are use this way in order to add a new WURFL's database.

You can check here my project on GitHub where I have put the file under META-INF folder and through the bnd file we explain to Liferay to "put" this file inside the original bundle.

Fragment-Host: com.liferay.portal.mobile.device.detection.fiftyonedegrees;bundle-version="1.0.9"

At the end we can change the configuration and link the new WURLF's database and restart the server.

Conclusion

This database is not updated daily and you can check here the update status of this file. When you try to add a new file don't use the same filename but change it.

Blogs

One clarification here is that WURF (https://web.wurfl.io/) and  51degrees (https://51degrees.com/) are two separate products. Liferay used to use WURFL in the past but recent versions use 51degrees. For those who relay on specific WURFL capabilities, 51degrees has a migration guide at https://51degrees.com/scientiamobile