Deploying a chrome packaged app and publishing updates on the chrome web store allows users to automatically receive application updates. There are situations where you want to know if the running application is the most current or not, and updating it. E.G.:
Documentation for chrome.runtime.requestUpdateCheck() offers a status of "throttled"
, "no_update"
, "update_available"
, but doesn't indicate what to do if a newer version is required.
Go to "About Google Chrome," and click Automatically update Chrome for all users. Linux users: To update Google Chrome, use your package manager. Windows users: Close all Chrome windows and tabs on the desktop, then relaunch Chrome to apply the update.
Chrome updates happen in the background automatically — keeping you running smoothly and securely with the latest features.
Devices might not be able to autoupdate to the latest version of Chrome OS for a few reasons. By default, Chrome devices autoupdate to the latest version of Chrome when it's available. In your Google Admin console, make sure that Device updates is set to Allow updates.
Install a listener for chrome.runtime.onUpdateAvailable
, which fires when the new .crx file has been downloaded and the new version is ready to be installed. Then, call chrome.runtime.requestUpdateCheck
:
chrome.runtime.onUpdateAvailable.addListener(function(details) {
console.log("updating to version " + details.version);
chrome.runtime.reload();
});
chrome.runtime.requestUpdateCheck(function(status) {
if (status == "update_available") {
console.log("update pending...");
} else if (status == "no_update") {
console.log("no update found");
} else if (status == "throttled") {
console.log("Oops, I'm asking too frequently - I need to back off.");
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With