• About Us
  • Blog
  • Basket
  • Account
  • Sign In


How to get Signatures/UserAgents from device model

Published on Friday, October 10, 2014

How to get Signatures/UserAgents from device model

Using Java

In some cases it may be useful to see what signatures/user agents in your 51Degrees data file are associated with specific content in a selected property.

The following snippet is written in Java and it implements the task in question. Essentially, what happens in this code is: "Hardware Model" properties in the data set are searched for values containing "HTC" or "Desire" or "Desire C". If one of these values is found, the corresponding signatures are fetched and printed.

try {
   Dataset ds = StreamFactory.create(DATA_FILE);
   System.out.println("Getting Signatures");
   for(Property p : ds.properties) {
	if (p.getName().equals("HardwareModel")) {
		for(Value v : p.getValues()) {
			if (v.getName().contains("HTC") ||
				v.getName().contains("Desire") ||
				v.getName().contains("Desire C")) {
				for(Signature s : v.getSignatures())
	System.out.println("Finished Getting Signatures");
} catch (IOException ex) {

When executed, this snippet produces result similar to the following:

Result of fetching signatures for corresponding HardwareModel from 51Degrees data file.
Result of fetching signatures for corresponding HardwareModel from 51Degrees data file.

This particular example uses the HardwareModel property that is available to Premium and Enterprise users. It can be altered to search for specific strings in any available property.

Try Premium Data Compare Data Files

Comments (0)

Products Team

Other posts by Products Team
Contact author



.NET 4G 51Degrees 5G Acer Adform Adtech Advertising Afilias Alcatel Amazon AMP Analysis Analytics Android Apache API Apple Asian Market ASP.NET Asus Blackberry Browser C C# Centro Chrome chromium Client hints Cloud CMS CPU CSS3 Data Data Blog Data File Daydream Design Detection Developers Device Device Data Device Detection Device Intelligence Device Models Device property DeviceAtlas Disney dmexco DotNetNuke Download ebay Ericsson Event Facebook Firefox Foundation Framework Galaxy git repositories Google Google Analytics Google Daydream GPU GSMA Guess HAProxy Hash Trie HTC HTML5 HTTP HTTP Headers Huawei Infinix Ingeniux Internet usage iOS iOS 13 ipad iPadOS iPhone iPhone 11 Java Javascript Kentico LG Liferay LTE m.dot Memory Memory leak Meta Data Microsoft Mobile Mobile Analysis Mobile Analytics Mobile Devices Mobile Marketing Mixer Motorola Mozilla MWC MWC 2017 MWC16 Native Apps NET New Release News Nexus NFC NGINX Nokia OnePlus 5 Opera Operating System Oppo Optimisation OS Patent Performance PHP Press Release Price Band programmatic Publishers Python Redirection Research Responsive Images Responsive web design RESS Review RTB RWD Safari Samsung Scala ScientiaMobile SEO Server Server-side optimisation Seznam.cz Sitecore Smart TV Smartphone Smartwatches Sony Swedish Beers Tablet Tencent Testing Tips Tutorial Umbraco Update User Agent User-Agent Valgrind Varnish Varnish Cache Video Vodafone VoLTE Web Web Apps Web content management Webtrekk White Paper Widgets WiFi Windows WURFL Xiaomi Xperia ZTE