android-components / mozilla.components.feature.addons.update / AddonUpdater


interface AddonUpdater (source)

Contract to define the behavior for updating addons.


Name Summary
Frequency class Frequency
Indicates how often an extension should be updated.
Status sealed class Status
Indicates the status of a request for updating an addon.
UpdateAttempt data class UpdateAttempt
Represents an attempt to update an add-on.


Name Summary
onUpdatePermissionRequest abstract fun onUpdatePermissionRequest(current: WebExtension, updated: WebExtension, newPermissions: List<String>, onPermissionsGranted: (Boolean) -> Unit): Unit
Invoked when a web extension has changed its permissions while trying to update to a new version. This requires user interaction as the updated extension will not be installed, until the user grants the new permissions.
registerForFutureUpdates abstract fun registerForFutureUpdates(addonId: String): Unit
Registers the given addonId for periodically check for new fun registerForFutureUpdates(extensions: List<WebExtension>): Unit
Registers the extensions for periodic updates, if applicable. Built-in and unsupported extensions will not update automatically.
unregisterForFutureUpdates abstract fun unregisterForFutureUpdates(addonId: String): Unit
Unregisters the given addonId for periodically checking for new updates.
update abstract fun update(addonId: String): Unit
Try to perform an update on the given addonId.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.


Name Summary
DefaultAddonUpdater class DefaultAddonUpdater : AddonUpdater
An implementation of AddonUpdater that uses the work manager api for scheduling new updates.