devicemap-client
This client is used to classify browser User-Agent strings.
This client requires devicemap-data. Data can be loaded via:
* URL
* JAR file
* Filesystem
# Code
//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, "http://devicemap-vm.apache.org/data/latest");
//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));
}
# Compile
## Maven
org.apache.devicemap
devicemap-client
1.2.0
devicemap-data JAR file:
org.apache.devicemap
devicemap-data
1.0.3