Since: API level 17
public class

NtpInfo

extends Object
implements Parcelable
java.lang.Object
   ↳ com.samsung.android.knox.datetime.NtpInfo

Class Overview

NTP(Network Time Protocol) info class. This class provides parameter for administrator to set and configure NTP server settings in the device. This class is always initialized with the system's default values so administrator can use them as a reference. If there is no intention to modify a specific field leave it as it is or explicitly set NOT_SET_INT or NOT_SET_LONG to that field. Note that 0 is considered as not set, so value should be greater than 0 to be used.

Since
API level 17
MDM 5.5
Multiuser Environment
Global Scope

Summary

Constants
int NOT_SET_INT Value to indicate field of type integer is not set and default system value should be used instead.
long NOT_SET_LONG Value to indicate field of type long is not set and default system value should be used instead.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Public Constructors
NtpInfo(Context context)
Default constructor of this class.
Public Methods
int getMaxAttempts()
Get the maximum of try again attempts to connect to the NTP server.
long getPollingInterval()
Get the polling interval the device tries to re-connect to the NTP server.
long getPollingIntervalShorter()
Get the shorter polling interval for retry connection.
String getServer()
Returns the NTP server set or null if none.
int getTimeErrorThreshold()
Deprecated in API level 33
NOTE: This API is not available since Android 11.
long getTimeout()
Get the timeout set for NTP server connection.
void setMaxAttempts(int maxAttempts)
Set the maximum of try again attempts to connect to the NTP server.
void setPollingInterval(long pollInterval)
Set the interval of time for the the device to re-connect the NTP server to update its time.
void setPollingIntervalShorter(long polInterShorter)
Set the shorter interval the device will wait to try again to connect to NTP server after previous connection attempt timed out.
void setServer(String server)
Set NTP server hostname/IP adress.
void setTimeErrorThreshold(int timeErrorThreshould)
Deprecated in API level 33
NOTE: This API is not available since Android 11.
void setTimeout(long timeout)
Set the timeout for connection to the NTP server.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int NOT_SET_INT

Since: API level 17

Value to indicate field of type integer is not set and default system value should be used instead. Can be used to reset fields.

Since
API level 17
MDM 5.5
Constant Value: 0 (0x00000000)

public static final long NOT_SET_LONG

Since: API level 17

Value to indicate field of type long is not set and default system value should be used instead. Can be used to reset fields.

Since
API level 17
MDM 5.5
Constant Value: 0 (0x0000000000000000)

Public Constructors

public NtpInfo (Context context)

Since: API level 17

Default constructor of this class. It will initialize the parameters with system's default values.

Parameters
context Context of calling application.
Since
API level 17
MDM 5.5

Public Methods

public int getMaxAttempts ()

Since: API level 17

Get the maximum of try again attempts to connect to the NTP server.

Returns
Since
API level 17
MDM 5.5

public long getPollingInterval ()

Since: API level 17

Get the polling interval the device tries to re-connect to the NTP server.

Returns
  • The polling interval in milliseconds or NOT_SET_LONG if not set.
Since
API level 17
MDM 5.5

public long getPollingIntervalShorter ()

Since: API level 17

Get the shorter polling interval for retry connection.

Returns
  • Polling interval shorter in milliseconds or NOT_SET_LONG if not set.
Since
API level 17
MDM 5.5

public String getServer ()

Since: API level 17

Returns the NTP server set or null if none.

Returns
  • NTP server hostname/IP address or null if none was set.
Since
API level 17
MDM 5.5

public int getTimeErrorThreshold ()

Since: API level 17

Deprecated in API level 33
NOTE: This API is not available since Android 11.

Get the time error threshold.

Returns
  • The time error threshold in milliseconds or NOT_SET_INT if not set.
Since
API level 17
MDM 5.5

public long getTimeout ()

Since: API level 17

Get the timeout set for NTP server connection.

Returns
Since
API level 17
MDM 5.5

public void setMaxAttempts (int maxAttempts)

Since: API level 17

Set the maximum of try again attempts to connect to the NTP server.

Parameters
maxAttempts Maximum number of try again attempts.
Since
API level 17
MDM 5.5

public void setPollingInterval (long pollInterval)

Since: API level 17

Set the interval of time for the the device to re-connect the NTP server to update its time.

Parameters
pollInterval The polling interval in milliseconds.
Since
API level 17
MDM 5.5

public void setPollingIntervalShorter (long polInterShorter)

Since: API level 17

Set the shorter interval the device will wait to try again to connect to NTP server after previous connection attempt timed out.

Parameters
polInterShorter The polling interval shorter in milliseconds.
Since
API level 17
MDM 5.5

public void setServer (String server)

Since: API level 17

Set NTP server hostname/IP adress.

Parameters
server The server must be in format of a machine name as "2.android.pool.ntp.org" or a textual representation of its IP address (e.g 192.168.0.2). Set null to revert to default android server.
Since
API level 17
MDM 5.5

public void setTimeErrorThreshold (int timeErrorThreshould)

Since: API level 17

Deprecated in API level 33
NOTE: This API is not available since Android 11.

Set the time error threshold. If the difference between current device time and NTP retrieved time is greater than the threshold the time will be updated.

Parameters
timeErrorThreshould The time error threshold in milliseconds.
Since
API level 17
MDM 5.5

public void setTimeout (long timeout)

Since: API level 17

Set the timeout for connection to the NTP server.

Parameters
timeout The timeout in milliseconds.
Since
API level 17
MDM 5.5