detectUpdate

open suspend fun detectUpdate(detectUpdateHandlerId: DetectUpdateHandlerId): DetectUpdateResult

Invoked by DetectUpdateTriggerWorker with a detectUpdateHandlerId to allow the service to detect if a new update is available.

How and when a service implementation detects if a new update is available for a component is entirely up to the implementation. Implementing this method is optional.

The detectUpdateHandlerId allows the UpdaterService to identify the update components to check. This can for instance identify a specific or a group of UpdateComponentIds. If another system is the source of the available UpdateComponentIds, the identifier can for example identify the source system. If the UpdaterService implementation does not need any additional identifier, it can remain empty.

Returns DetectUpdateResult.SUCCESS, if the check was successful. Returns DetectUpdateResult.FAILURE otherwise. The default implementation returns DetectUpdateResult.SUCCESS.

Note: This method will not be automatically called. Use DetectUpdateTriggerWorker to invoke this method. The DetectUpdateTriggerWorker will consider the check to be successful if this function returns DetectUpdateResult.SUCCESS. The function must suspend while the update check is ongoing to unblock other function calls. If the function returns DetectUpdateResult.FAILURE, the DetectUpdateTriggerWorker work will then be rescheduled according to its backoff criteria.