public class Match extends Object
Access Property values using the
getValues(java.lang.String) method for property names and
getValues(fiftyone.mobile.detection.entities.Property) for property
objects. For example: match.getValues("IsMobile");
All values are returned as strings unless you request a specific format:
match.getValues("ScreenPixelsWidth").toDouble();
If you want a more general device information like the rank you should use
getSignature() method which returns a Signature object this
device relates to.
Match also provides various metrics properties: device Id, method used, difference and rank.
components where each
component is the Id of the Profile matched by the detector.
Access like:
match.getDeviceId();
match.getMethod();
For more information on the detection methods see: how Pattern device detection works.
Keeping the data file up to date improves the overall quality of detection as the 51Degrees data team adds (on average) 200 new devices to our database each week. With Premium and Enterprise data files can benefit from the automatic data updates as well as a wider range of properties and more devices.
This object should not be created manually in the external code. Use one of
the match methods in the Provider class to obtain a match object
with data members initialised.
For more information see https://51degrees.com/Support/Documentation/Java
| Modifier and Type | Method and Description |
|---|---|
int |
getClosestSignaturesCount() |
Dataset |
getDataSet() |
String |
getDeviceId()
The unique id of the device represented by the match.
|
byte[] |
getDeviceIdAsByteArray()
Id of the device represented as an array of bytes.
|
int |
getDifference()
The numeric difference between the target User-Agent and the match.
|
long |
getElapsed() |
MatchMethods |
getMethod()
Returns the detection method used to obtain this object.
|
int |
getNodesEvaluated() |
int |
getNodesFound() |
Profile[] |
getProfiles()
Array of
profiles associated with the device that was
found. |
Map<String,String[]> |
getResults()
Deprecated.
use getValues methods
|
int |
getRootNodesEvaluated() |
Signature |
getSignature()
Returns a
Signature that best fits the provided User-Agent string. |
int |
getSignaturesCompared() |
int |
getSignaturesRead() |
int |
getStringsRead() |
String |
getTargetUserAgent() |
String |
getUserAgent() |
Values |
getValues(Property property)
Gets the
Values associated with the property name using the
profiles found by the match. |
Values |
getValues(String propertyName)
Gets the
Values associated with the property name using the
profiles found by the match. |
String |
toString()
A string representation of the nodes found from the target User-Agent.
|
void |
updateProfile(int profileId)
Override the profiles found by the match with the profileId provided.
|
public String getTargetUserAgent()
public long getElapsed()
public Signature getSignature()
Signature that best fits the provided User-Agent string.
A signature can be used to retrieve profiles and rank.Signature with best match to the User-Agent provided.public MatchMethods getMethod()
getDifference() should be used to assess the accuracy of
the detection. The higher the number the less confident the detector is.
With Premium or Enterprise data files you will see more "Exact" detections as the number of device combinations available in these files is significantly larger than in the "Lite" data file. Compare data options
For more information on detection methods see: how Pattern device detection works
MatchMethods used to obtain match.public int getClosestSignaturesCount()
public int getSignaturesCompared()
public int getSignaturesRead()
public int getRootNodesEvaluated()
public int getNodesEvaluated()
public int getNodesFound()
public int getStringsRead()
public Profile[] getProfiles() throws IOException
profiles associated with the device that was
found. Profiles can then be used to retrieve properties
and values.profiles associated with the device
that was found.IOException - if there was a problem accessing data file.public int getDifference()
public String getDeviceId() throws IOException
profiles separated by hyphen symbol. One profile
is chosen per each component.
Device Id can be stored for future use and the relevant
properties and values restored using the
Provider.matchForDeviceId(java.lang.String) method.
IOException - if there was a problem accessing data file.public byte[] getDeviceIdAsByteArray()
throws IOException
To obtain the unique profile IDs wrap the byte array in a ByteBuffer and
use getInt() repeatedly.
To obtain a Match with the corresponding
properties and values use the
Provider.matchForDeviceId(byte[]).
IOException - if there was a problem accessing the data file.public String getUserAgent()
@Deprecated public Map<String,String[]> getResults() throws IOException
IOException - if there was a problem accessing data file.public Values getValues(Property property) throws IOException
Values associated with the property name using the
profiles found by the match. If matched profiles don't contain a value
then the default profiles for each of the components are also checked.property - The property whose values are required.IOException - if there was a problem accessing data file.public Values getValues(String propertyName) throws IOException
Values associated with the property name using the
profiles found by the match. If matched profiles don't contain a value
then the default profiles for each of the components are also checked.propertyName - The property name whose values are required.IOException - if there was a problem accessing data file.public void updateProfile(int profileId)
throws IOException
profileId - The ID of the profile to replace the existing componentIOException - indicates an I/O exception occurredCopyright © 2015 51Degrees. All rights reserved.