Marek Degma
Nov 07, 2018
5:57 pm

DateTimePolicy.setNtpInfo has no effect whatsoever

I am building an internal Android application that is intended to run on a secured internal network with no access to the internet. Therefore, the app has to override NTP settings to point to internal NTP server. The application successfully performs the update as described here (

EnterpriseDeviceManager edm = (EnterpriseDeviceManager) getSystemService
 DateTimePolicy dateTimePolicy = edm.getDateTimePolicy();
 try {
     boolean ntpInfoSet = true;
     NtpInfo ntpInfo = new NtpInfo(this.getApplicationContext());
     ntpInfo.setTimeout(10000); // 10 seconds
     ntpInfo.setPollingInterval(43200000); // 12 hours
     ntpInfo.setPollingIntervalShorter(30000); // 30 seconds
     ntpInfo.setTimeErrorThreshold(1000); // 1 second
     ntpInfoSet = dateTimePolicy.setNtpInfo(ntpInfo);
     if (ntpInfoSet) {
         // operation was successfull
     } else {
         // operation failed
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);

And indeed, the DateTimePolicy.NtpInfo reflects the updated values even upon application restart. However, /system/etc/gps.conf still looks like this:

What am I doing wrong?

Similar topics

No similar topics found.