Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cause a chrome app to update as soon as possible?

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.:

  • Just keeping the user on the most recent version.
  • Detecting a mismatch between the application and server side APIs, and requiring the client side application to update to use new server side APIs.

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.

like image 464
Vincent Scheib Avatar asked Apr 02 '13 21:04

Vincent Scheib


People also ask

How do I trigger Chrome updates?

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.

Does Chrome update apps automatically?

Chrome updates happen in the background automatically — keeping you running smoothly and securely with the latest features.

Why is Chrome not updating automatically?

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.


1 Answers

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.");
  }
});
like image 195
Antony Sargent Avatar answered Sep 28 '22 12:09

Antony Sargent