# UpdateScheduleRegistry

Import: `import com.install4j.api.update.UpdateScheduleRegistry;`

```java
public class UpdateScheduleRegistry
```

Administrates an update schedule for your application. This class is intended to be called by
your application. You have to call [`UpdateScheduleRegistry.setUpdateSchedule`](UpdateScheduleRegistry.md#setupdateschedule-updateschedule) at some point and
then call [`UpdateScheduleRegistry.checkAndReset`](UpdateScheduleRegistry.md#checkandreset) each time you start up your application (or whenever it is convenient)
to find out if you should check for an update. Note that no updater is started automatically, you have to
start a suitable updater with the [`ApplicationLauncher`](../launcher/ApplicationLauncher.md) class.

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`checkAndReset()`](#checkandreset) | `boolean` | Checks if you should check for an update. |
| [`setUpdateSchedule(UpdateSchedule)`](#setupdateschedule-updateschedule) | `void` | Sets the new update schedule. |
| [`getUpdateSchedule()`](#getupdateschedule) | `UpdateSchedule` | Returns the configured update schedule. |
| [`getLastUpdateCheckDate()`](#getlastupdatecheckdate) | `Date` | Returns the date of the last update check. |
| [`checkedForUpdate()`](#checkedforupdate) | `void` | Tells the registry that the current time should be set as the last update check date. |

### checkAndReset()

```java
public static boolean checkAndReset()
```

Checks if you should check for an update. If the configured update schedule and the last
time you checked for an update require a new check, this method returns true and sets the
time for the last update check to the current time.


**Returns:** if you should start an updater with the [`ApplicationLauncher`](../launcher/ApplicationLauncher.md) class

### setUpdateSchedule(UpdateSchedule)

```java
public static void setUpdateSchedule(UpdateSchedule updateSchedule)
```

Sets the new update schedule.


**Parameters:**

- `updateSchedule` — the update schedule

### getUpdateSchedule()

```java
public static UpdateSchedule getUpdateSchedule()
```

Returns the configured update schedule.


**Returns:** the update schedule or `null` if no update schedule has been configured so far

### getLastUpdateCheckDate()

```java
public static Date getLastUpdateCheckDate()
```

Returns the date of the last update check. This date is updated when [`UpdateScheduleRegistry.checkAndReset`](UpdateScheduleRegistry.md#checkandreset) returns
`true` or when [`UpdateScheduleRegistry.checkedForUpdate`](UpdateScheduleRegistry.md#checkedforupdate) is called.


**Returns:** the last update check date

### checkedForUpdate()

```java
public static void checkedForUpdate()
```

Tells the registry that the current time should be set as the last update check date. Usually,
you do not need to call this method since [`UpdateScheduleRegistry.checkAndReset`](UpdateScheduleRegistry.md#checkandreset) sets it automatically if required.

