Question

Requirement is to detect the originating device and platform for the HTTP request made to a web application.

For instance it is required to detect does the request originated from desktop browser, tab or mobile along with its OS details. (For e.g.: A request can come from chrome on android)

Spring Mobile project provides an API to detect the device viz. Mobile, tablet or normal (desktop); but it does not provide any details about the platform viz. Windows, iOS or Android. On further analysis it seems under the hood Spring Mobile project utilizes the 'User Agent' header in HTTP request which might not be a reliable way to determine the device & platform.

Please let know if there is a third party library available which does the task or any pointers which would help achieve the requirement.

Was it helpful?

Solution

As you correctly stated Spring Mobile uses the 'User Agent' HTTP Header to perform detection. The only credible way that I know of, that would give you a good clue of what kind of platform the client is running, is to run some kind of OS Detection Scan like NMAP does which is based on TCP fingerprinting.

I seriously doubt you would want to use something like that in a server environment

Here is an article which extensively discusses device detection (no OS detection)

OTHER TIPS

you can user @RequestHeader("User-Agent") to get user agent header which contains os name , device etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top