Class UpdateScheduleRegistry

java.lang.Object
com.install4j.api.update.UpdateScheduleRegistry

public class UpdateScheduleRegistry extends Object
Administrates an update schedule for your application. This class is intended to be called by your application. You have to call setUpdateSchedule(UpdateSchedule)} at some point and then call 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 class.
  • Method Details

    • checkAndReset

      public static boolean checkAndReset()
      Checks if you should check for an update. If the configured update schedule and 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 class
    • setUpdateSchedule

      public static void setUpdateSchedule(UpdateSchedule updateSchedule)
      Sets the new update schedule.
      Parameters:
      updateSchedule - the update schedule
    • getUpdateSchedule

      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

      public static Date getLastUpdateCheckDate()
      Returns the date you last called checkAndReset() and got a return value of true.
      Returns:
      the last update check date
    • checkedForUpdate

      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 checkAndReset() sets it automatically if required.