Detect Device Type In Java Web Application

Detect Device Type In Java Web Application explain about identifying the device type such as desktop, tablet or mobile of client by accessing your Website.

For example, in your project you need to show 2 different versions of website. One is for mobile viewers and another for desktop viewers. For this you need to identify whether the request coming form a Mobile device. After detecting device type using user-agents string from HttpServletRequest. you can forward to different urls.

How to identify whether a user request is coming from Mobile/Tablet/Desktop?

For identifying the device type (whether the request is coming from mobile, tablet or desktop), you need to parse User-Agents string in your java web application, It is server side device detection.

We have following 3 approaches to detect the device types by parsing User-Agents.

1) By Using UADetector
2) By Using user-agent-utils
3) By Using Spring Framework

How To Detect Device Type Using Spring

Detect Device Type Using Spring explaining about identifying the device type of a client (such as desktop, tablet or mobile) accessing your Website by using spring framework.

How to identify using Spring whether a user request is coming from Mobile/Tablet/Desktop?

For example, in your project you need to show 2 different versions of website. One is for mobile viewers and another for desktop viewers. For this you need to identify whether the request coming form a Mobile device. After detecting device type by scanning user-agents string from java HttpServletRequest. you can forward to different urls.

In our application also, we need to have this feature. Fortunately in our application using spring as dependency. By adding spring-mobile-device-1.0.1.RELEASE.jar, we could able to achieve what we want

Detect user is from Mobile/Tablet/Desktop Using Spring Framework?

In this example we are identifying the device type such as desktop, tablet or mobile of client accessing your Website.