Java Client 1.1.0


-Include the following 2 maven dependencies:

{{{#!highlight xml

NOTE: If using LoaderOption URL or FOLDER, you can drop the above devicemap-data dependency.

-Include the following Java code:

{{{#!highlight java
//get client using JAR data source
DeviceMapClient client = DeviceMapFactory.getClient(LoaderOption.JAR);

//get client using data from a URL
//DeviceMapClient client = DeviceMapFactory.getClient(LoaderOption.URL, "");

//get client using data from a local filesystem
//DeviceMapClient client = DeviceMapFactory.getClient(LoaderOption.FOLDER, "/some/path/devicemap/latest/devicedata");

String userAgent = "Mozilla/5.0 (Linux; U; Android 2.2; en; HTC Aria A6380 Build/ERE27) AppleWebKit/540.13+ (KHTML, like Gecko) Version/3.1 Mobile Safari/524.15.0";

//classify the userAgent
Device device = client.classifyDevice(userAgent);

System.out.println("Device detected: " + device.getId());

//iterate thru the attributes
for (String attr : device.getAttributes().keySet()) {
System.out.println(attr + ": " + device.getAttribute(attr));

Java Client 1.0.0


  • No labels