Updating Device Data
Keeping device data up-to-date is almost as important as regularly installing security updates as it affects your customers. Correctly identifying the latest devices, Operating Systems and browsers allows you to provide your customers with the most relevant version of your website and content. Our data team work tirelessly to update our database on a daily basis.
We understand that manually downloading the latest data file is time consuming and inefficient, so we have introduced automatic updates functionality. This allows your API to automatically retrieve the latest data file from our servers using your licence key and update your current device data file with the latest version.
If you are a Premium or Enterprise customer you can get started with automatic data updates straight away, see the next section for more details. Lite data users are welcome to test drive automatic updates by signing up with our free evaluation programme. When trialling the Premium and Enterprise data file versions you can experience the benefits of having more properties and device combinations as well as more frequent updates. Compare the features offered by each data file.
For general information about the auto update feature see the Automatic Data Updates documentation page.
Java Specific Information
51Degrees core Java API provides a static method in the AutoUpdate.java class that can be invoked to retrieve device data. Invoke the update method by providing it with your licence key(s) and a path to the data file you wish to update. The API implements several data integrity checks to make sure data was not damaged during the transfer. For automatic updates with Java Servlets please see this page .
import fiftyone.mobile.detection.AutoUpdate ; import fiftyone.mobile.detection.AutoUpdateStatus ; import java.security.NoSuchAlgorithmException ; public class UpdateDeviceData { private final static String KEY = "Your licence key here" ; private final static String PATH = "Path to data file." ; public static void main ( String [] args ) throws NoSuchAlgorithmException , IllegalArgumentException , Exception { AutoUpdateStatus status = AutoUpdate . update ( KEY , PATH ); if ( status == AutoUpdateStatus . AUTO_UPDATE_SUCCESS ) { System . out . println ( "Update successfull." ); } else if ( status == AutoUpdateStatus . AUTO_UPDATE_NOT_NEEDED ) { System . out . println ( "Update not currently required." ); } else { System . out . println ( "There was a problem updating the data file: " + status ); } } }
When invoking the update please keep in mind that the data file should be free of write locks, otherwise the API will not be able to replace the file.