- Updating Device Data
- Web Apps
- SQL Server
- Reference Pages
- Useful Links
- Supported Versions
This tutorial illustrates how to return a match for a Device Id. It shows how to first get the Device Id from a match, then get a match for that Device Id and return the value of the IsMobile property. This can be useful to look at devices that have already been matched at a previous date.
Code and Explanation
Match for device id example of using 51Degrees device detection. The example
shows how to:
string fileName = args;
DataSet dataSet = StreamFactory.Create(fileName, false);
Provider provider = new Provider(dataSet);
match = provider.MatchForDeviceId(deviceId);
IsMobile = match["IsMobile"].ToString();This tutorial assumes you are building this from within the 51Degrees Visual Studio solution. Running the executable produced inside Visual Studio will ensure all the command line arguments are preset correctly. If you are running outside of Visual Studio, make sure to add the path to a 51Degrees data file as an argument.
In this tutorial you have seen how to use the detector to retrieve the IsMobile property for a pre-defined Device ID string. The example can easily be modified to retrieve the value of any other property. Premium and Enterprise data files provide considerably more properties such as IsCrawler , PriceBand , HardwareVendor and ScreenInchesWidth . For a full list of properties and the data files they exist in please see the Property Dictionary .