liveUpdate

What is liveUpdate?

liveUpdate allows you to update your app without submitting your changes to the various app stores.

Why use liveUpdate?

  • Get Changes to your Customers’ Devices Faster - liveUpdates are delivered directly to your customers’ devices over the Internet and downloaded in the background as your application runs, completely avoiding the appstore. You no longer have to wait days for approval to update your application.
  • Various Update Options – With liveUpdate you have the option to choose how the update is applied. An update can be mandatory or optional and up to the user to decide. With liveUpdate you have the flexibility of choice.
  • Phased Development – By using liveUpdate to improve your application, you can deliver your product in “phases”. Allowing you to get your app in the marketplace sooner.

Getting started using liveUpdate

liveUpdate does not require that any additional code be added to your app. However, you do have the option to add liveUpdate code to give you more control regarding how and when updates are applied. Components of each liveUpdate are:

  • Message to User : - Message to display to user on update. This parameter is required.
  • Description : - The description explaining the reason for the liveupdate.This is rendered the Live Update History This parameter is optional.

When you are ready to apply a liveUpdate, you have several options on how your application handles the update. Select one of the four behaviors when submitting your liveUpdate

  • Option 1: Request permission and notify app – If this choice was made when the liveUpdate was sent, a pop-up message from the operating system will ask the user whether they want to update their application immediately or not. The liveUpdate message is displayed to the user in this pop-up. If the user selects “Yes”, the application will immediately restart using the updated application. If the user selects “No”, the application will instead notify the application just as if the final choice in this list had been made.
  • Option 2: Automatically Install the Update – If this choice was made when the liveUpdate was sent, a pop-up message from the operating system will notify the user about update of their application immediately. The new bundle will be downloaded and automatically.
  • Option 3: Load update at next restart – On app start or resume, the container will be notified of the update. The new bundle will be silently downloaded in the background and will be installed on the following app start.
  • Option 4: Notify the Application – The final option puts control of the update completely in the hands of the developer and allows them to code their application to handle the update by themselves. Once an update is available, the application will be notified either at startup through the AppMobiCloud.updateAvailable parameter or during runtime through the updateAvailable event. The liveUpdate message is included as the updateMessage property in this event. Once an update has been detected, developers may choose to kick off the update or not depending on how they would like their application to behave. See the liveUpdate Sample Application for more information.

Zip Bundle

In general, a bundle consists of all the necessary project files like HTML, javascripts and CSS stylesheets (files with format from IDEs such as .project and .xdke should be ignored). As shown below, the necessary files – index.html, appMobi.js, ajax-loader.gif , logo.png and LICENSE.am are compressed to form a .zip bundle and this bundle should be uploaded for liveUpdate. liveUpdate bundle must include LICENSE.am file, which can be retrieved from Sample Project of Corresponding App of Appmobi platform.

../_images/zip-bundle.png

Example

If the liveUpdate notifies the application and allows it to handle the update, there are several steps illustrated by this example to handle that process.

  • Update Available While Executing – If the application completes downloading its update while the application is running then the updateAvailable event will be triggered. In this example, that event will call the onUpdateAvailable function. From that point, the application will warn the user that an update is available by changing the text and animating the marquee below the newscaster with the update message. Touching the animated marquee will call the updateApplication function that will immediately start the update. This function calls the installUpdate method which will immediately restart the application using the updated version of the application.
/* OVER THE AIR UPDATE CODE */
// This event handler captures the event thrown when an update becomes available
// while an application is running document.addEventListener("appMobi.device.update.available",onUpdateAvailable,false);
function onUpdateAvailable(evt) {
   if (evt.type == "appMobi.device.update.available") {
      // There is an update available *while* the application is running - just warn the user
     AppMobiCloud.device.installUpdate();
   }
}
  • Update Available at Startup – If the application completes downloading its update in a previous session but the update is refused or postponed, the application will be available as soon as the application restarts. In the onDeviceReady function, the following code block will test whether an update is available. If an update is in fact available, the sample application will forward the user to the doUpdateAvailable function. This will give the user the choice between updating their application or putting it off until the next install. However, that portion of the application could be replaced with any sort of decision structure the developer might wish.
function onUpdateAvailable(evt) {
   if (evt.type == "appMobi.device.update.available") {
      // There is an update available *while* the application is running - just warn the user
   AppMobiCloud.device.installUpdate();
}

In the sample, if the user chooses to install immediately the code will ultimately execute the updateApplication function.

  • Note – At the first time of liveUpdate you need to upload all files in bundle and for the next time you can do partial liveUpdate with files that has been changed.

Version history with real time Revert function

  • Live Update History - Live Update history contains your all uploaded bundles with their versions,name,description & date time. You can revert any of the update from your previous ones by clicking on Revert button.
  • Revert Live Update - With Revert live Update you have the option to choose how the update is applied. A Revert update is optional and up to the user to decide. With revert live Update you have the flexibility of choice from your previous live updates without submitting of new bundle to the server and recycle it (reverted).
../_images/app_Mobi_Live_Update.PNG