Check out OpenDDR Live demos hosted by Jelastic.
Classifier cl = Classifier.builder().with(option, loaderPath).build(); Device device = cl.classifyDevice("A User Agent"); if (device != null) { System.out.println("Device ID: '" + device.getId() + "'."); System.out.println("Device as JSON: "); System.out.println(device.toString()); } else { System.out.println("No device found."); }
private static void init() { private static final String CONFIG_FILE = "/oddr.properties"; Properties initializationProperties = new Properties(); try { initializationProperties.load(SimpleConsole.class.getResourceAsStream(CONFIG_FILE)); identificationService = ServiceFactory.newService("mobi.openddr.simple.DDRService", initializationProperties.getProperty(DDRService.ODDR_VOCABULARY_IRI), initializationProperties); } catch (Exception ex) { throw new RuntimeException(ex); } } private static void identify(String ua) { PropertyRef vendorRef; PropertyRef modelRef; PropertyRef displayWidthRef; PropertyRef displayHeightRef; PropertyRef osVersionRef; PropertyRef osRef; try { vendorRef = identificationService.newPropertyRef("vendor"); modelRef = identificationService.newPropertyRef("model"); displayWidthRef = identificationService.newPropertyRef("displayWidth"); displayHeightRef = identificationService.newPropertyRef("displayHeight"); osRef = identificationService.newPropertyRef("device_os"); osVersionRef = identificationService.newPropertyRef("device_os_version"); } catch (NameException ex) { throw new RuntimeException(ex); } final PropertyRef[] propertyRefs = new PropertyRef[] { vendorRef, modelRef, displayWidthRef, displayHeightRef, osRef, osVersionRef }; final Evidence e = new ODDRHTTPEvidence(); try { PropertyValues propertyValues = identificationService.getPropertyValues(e, propertyRefs); PropertyValue vendor = propertyValues.getValue(vendorRef); PropertyValue model = propertyValues.getValue(modelRef); PropertyValue displayWidth = propertyValues.getValue(displayWidthRef); PropertyValue displayHeight = propertyValues.getValue(displayHeightRef); PropertyValue os = propertyValues.getValue(osRef); PropertyValue osVersion = propertyValues.getValue(osVersionRef); } catch (Exception ex) { throw new RuntimeException(ex); } }
Day after day we all experience an incredible growth and fragmentation of devices available on a more and more proliferated market. Accurately tracking their specs has become very hard work. But this complexity can be reduced if managed by a community daily involved in improving the Device Description Repository (DDR). This is the essence of the OpenDDR project, the best open, free actively maintained repository of device descriptions currently available.
OpenDDR is the ultimate open solution to the device fragmentation issues. Because of the wide diversity of devices available on the market, the developers dealing with web content optimization need to know hardware and software specs of each device. To face this situation the most effective solution is using a Device Description Repository, a database storing a huge amount of information concerning mobile phones, tablets, Interactive TVs, set top boxes and any device with a Web browser.
PThe OpenDDR project was created by a group of web & mobile developers knowing the importance of an up-to-date, open, transparent Device Description Repository (DDR), and proper APIs to access it. We think that identifying hardware and software features of the accessing clients is a basic need, a commodity that should be available to any developer to allow a better software design. We started looking for all the available and open sources of device descriptions and we thought how to guarantee for the future the freedom of choice to other developers, like us: the solution we found was relying on W3C standards. One of the sources we looked at was the content of the file wurfl.xml, in its version dated April 24th 2011, the last one with open terms of use, consistent with the initial spirit of wurfl.xml project, and respectful toward “many different people from many different countries” collecting data for them over the years.
PAs Apache DeviceMap was archived at the end of 2016 and we found references and e.g. StackOverflow questions on OpenDDR as recent as November 2016 to have always exceeded the same for DeviceMap (even while commits happened there) we decided to reactivate OpenDDR again to allow easier and faster maintenance than Apache Foundation could provide for Open Data rather than source code.
© 2016-2023, OpenDDR. Bootstrap Themes Designed by BootstrapMaster in Poland