devicemap-client

To install the devicemap-client artifact locally, run:

mvn install

The devicemap-client has a dependency on devicemap-data. Make sure that artifact
is available to this project.

Once installed, the following Java code runs the client:

  //create a client object, store this somewhere permanent
  DeviceMapClient client = new DeviceMapClient();

  //load the device data, do this only once!!!
  client.initDeviceData(LoaderOption.JAR);

  //classify a User-Agent string
  String test = "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";
  Map<String, String> m = client.classify(test);

  //iterate thru the attributes
  for (String attr : m.keySet()) {
      System.out.println(attr + ": " + m.get(attr));
  }

The above code has the following devicemap dependencies:

  <dependency>
    <groupId>org.apache.devicemap</groupId>
    <artifactId>devicemap-client</artifactId>
    <version>1.0</version>
  </dependency>
  <dependency>
    <groupId>org.apache.devicemap</groupId>
    <artifactId>devicemap-data</artifactId>
    <version>1.0</version>
  </dependency>

