This tutorial illustrates the basic use of the 51Degrees API using the Trie detection method. It will show you how to create a provider and how to obtain a value for the IsMobile property.
Code and Explanation
Getting started example of using 51Degrees device detection. The example
shows how to:
Load the 51Degrees Hash Trie library
res = FiftyOneDegreesTrieV3.class.getResource("/FiftyOneDegreesTrieV3.so");
Instantiate 51Degrees detection provider
provider = new Provider("path/to/51Degrees/data/file.trie");
Pass in a single HTTP User-Agent header
Match match = provider.match(userAgent);
Extract the value of the IsMobile Property
main assumes it is being run with a working directory at root of
project or of this module.
In this tutorial you have seen how to use the detector to retrieve the
property for a pre-defined User-Agent string. The example can easily be modified to retrieve the value of any other property. Premium and Enterprise data files provide considerably more properties such as
. For a full list of properties and the data file versions they exist in please see the