51Degrees Device Detection Java  4.1

Device detection services for 51Degrees Pipeline

fiftyone.devicedetection.examples.Comparison Class Reference

Detailed Description

Configuration

As standard the Hash provider is available by uncommenting the code starting at the FiftyOneDegreesHashTrieProvider method and then adding the compiled Hash JAR as a dependency which can be found here.

You can build a new version of the dependency by cloning this repository and following these steps:

NOTE: SWIG and and Maven are required to compile a new JAR dependency


git clone https://github.com/51Degrees/Device-Detection
cd Device-Detection/java/
build.sh (build.bat for Windows)
cd trie
mvn install

Add the compiled JAR file to your project and ensure you add a reference to your Hash Trie data file when you run the comparison.

Compares multiple device detection methods for accuracy and performance outputting a single CSV file where each row contains the results from one or more solutions for each of the target User-Agents provided.

Expected Results

Provider Browscap 51Degrees
Time to initialise provider (ms) 7,571.2 311.4
Average time per detection per thread (ms) 0.0137752 0.0108086 The comparison was performed using a single thread on a Lenovo G710 Laptop with a Quad Core 2.2GHz CPU and 8GB of main memory. Input data: 51Degrees-Enterprise device data and a sample of 20,000 User-Agents

Browscap, or Browser Capabilities project , is an open source project which maintains and offers free downloads of a browscap.ini file, a browser capabilities database. It is a list of all known browsers and bots, along with their default capabilities and limitations.

This example implements the Blueconic java library which is available on GitHub and Maven.

Note: the implementations for WURFL and DeviceAtlas has not been tested by the original author as 51Degrees do not have access to the associated source code or data files. They have been generated theoretically from the associated API documentation provided but are intended to be easy to modify. The code marked "UNCOMMENT" will need to be uncommented and the associated packages and data files obtained from ScientiaMobile and / or DeviceAtlas to enable the associated providers.

Inheritance diagram for fiftyone.devicedetection.examples.Comparison:

[legend]

Collaboration diagram for fiftyone.devicedetection.examples.Comparison:

[legend]

Classes

class  BrowsCapProvider
Uncomment the following code blocks to test with BrowsCap.
interface  ComparisonProvider
Common interface supported by each of the solution vendors.
class  DeviceAtlasProvider
Uncomment the following code blocks to test with DeviceAtlas.
class  FiftyOneDegreesBaseProvider
class  FiftyOneDegreesHashMemoryProvider
Loads all the data into initialised data structures.
class  Request
Includes the requesting User-Agent and a list of results from each of the providers used.
class  Result
class  ResultIterator
class  WurflProvider
Uncomment the following code blocks to test with WURFL.

Public Member Functions

double  getAverageDetectionTimePerThread ()
int  getCount ()
void  run (ComparisonProvider provider, LinkedList< Request > requests, int numberOfThreads) throws IOException, InterruptedException

Static Public Member Functions

static void  main (String[] args) throws Exception
Instantiates this class and starts runComparisons(String, String, String, String, String, int) with parameters from the command line. More...

Member Function Documentation

◆ main()

static void fiftyone.devicedetection.examples.Comparison.main ( String []   args ) throws Exception
static

Instantiates this class and starts runComparisons(String, String, String, String, String, int) with parameters from the command line.

When run from the command line the first and last file arguments must be a file of User-Agents and the file that the comparison results will be written to. Files between the first and last file are optional and provide the FiftyOneDegrees, WURFL and DeviceAtlas data files. A final optional argument of type integer can be provided to determine the number of concurrent threads to use during processing if the provider supports multi threaded operation.

Parameters
args - command line arguments.
Exceptions
IOException - if the data file cannot be accessed.
InterruptedException - if the comparison threads are interrupted.