You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devicemap.apache.org by re...@apache.org on 2014/07/08 20:07:41 UTC
svn commit: r1608867 -
/incubator/devicemap/trunk/devicemap/java/classifier/README
Author: rezan
Date: Tue Jul 8 18:07:41 2014
New Revision: 1608867
URL: http://svn.apache.org/r1608867
Log:
readme file
Added:
incubator/devicemap/trunk/devicemap/java/classifier/README
Added: incubator/devicemap/trunk/devicemap/java/classifier/README
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/classifier/README?rev=1608867&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/classifier/README (added)
+++ incubator/devicemap/trunk/devicemap/java/classifier/README Tue Jul 8 18:07:41 2014
@@ -0,0 +1,39 @@
+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>
+