Live Update is a new feature in RhoMobile Suite 5.1 that instantly displays changes to many parts of a RhoMobile app on-device without the need to manually recompile and redeploy. This enables on-the-fly programming and debugging on multiple mobile devices at the same time. It supports Android, iOS, the Apple iOS simulator, and Windows Mobile/CE in any combination.
Live Update works by monitoring files in the /apps and /public folders of your RhoMobile app and builds a complete or partial update bundle that can either deploy immediately or on command. Once notified of an update, the target device(s) download the bundle from the development host (on which Live Update embeds a web server), apply it and refresh the Webview to display the changes. Live Update works through RhoStudio or from the command line.
This guide provides an overview of the Live Update setup process from within RhoStudio’s Project Explorer and text editor. Once it’s familiar, this process should require just a few minutes to complete. Some of the steps also can be performed from the command line and/or using your favorite text editor.
Live Update has four modes of operation:
Partial Update packages the portions of a project that have changed and notifies devices that a download is available. This on-command feature works only from the command line and must be initialized before each debugging session. Use this mode when you want to make multiple changes and see them applied on command instead of each time a file is saved.
Full Update packages all files in a project regardless of whether they’ve been changed and notifies devices. This on-command feature works only from the command line and does not require initialization.
Auto Update monintors all files in a project and automatically packages the app and notifies devices every time changes are saved. This mode is invoked by pressing the ‘Enable Live Update’ button in the Live Update Settings page in RhoStudio or using the CLI command below. It can be monitored and stopped from the Progress tab or using the CLI command below.
Build and Notify mode is intended for use when integrating Live Update with an external build system. This CLI-only feature is invoked with the ‘rake dev:update:build_and_notify’ command.
Live Update receives change info from two files stored in the project’s root level:
upgrade_package_add_files.txt
lists the project’s new or modified filesupgrade_package_remove_files.txt
lists files removed from the projectLive Update works only on ‘RhoElements’ apps built with RhoMobile Suite 5.1 or higher.
build.yml
fileHere’s a quick overview of the steps required to enable Live Update on a new or existing RhoElements app. When setting it up for the first time, we recommend using the detailed instructions that follow. Once it’s familiar, this process should require just a few minutes to complete using these quick-setup steps.
build.yml
contains the line ‘build: debug’build.yml
dev-config.yml
will appear in projectdev-config.yml
with text editor and add ‘refresh: 1’ (not indented) after device section(s) to enable Live Update for allFollowing this process, an update will occur each time a file is saved, placed in or removed from the /app or /public folders. If you’re having trouble, refer to the detailed instructions or troubleshooting section below.
The first Live Update in a session could take several minutes to appear; subsequent updates generally occur after a few seconds. |
This section contains detailed instructions for configuring Live Update on a development host. It follows the same general sequence as the Quick Setup above.
Live Update works only on apps built with the RhoElements option box checked (as below). To confirm that your app is compatible, check for the line app_type: “rhoelements” in its build.yml
file (as in the image that follows, below).
After your app is created but before it’s built and deployed to the device:
build.yml
file and select “Open With > Text Editor”
build.yml
contains the line ‘build: debug’ (quotes will be inserted automatically when it’s built)Skip this step if your Wi-Fi network consists of a single subnet (most common).
Live Update requires that subscriber device(s) be on the same Wi-Fi subnet as the development host. That means that the first three figures of a device’s IP address match those of every other device as well as those of the development host, and that the fourth figure does not. Setting this up it might require help from your IT department.
To try it yourself:
The screenshot above shows the Network Preferences panel of Mac OS X after entering the Wi-Fi section, clicking the Advanced… button and selecting the TCP/IP tab. In the case, the machine’s subnet is “10.186.6” and it’s using DHCP. Click on the drop-down (indicated by the arrow) and select “Use DHCP with manual address” to allow a user-assigned IP address that’s in the same subnet as the target device(s).
CAUTION: Manually editing IP addresses can lead to address conflicts and interruptions in service. We recommend consulting with IT before making changes. |
build.yml
has beed edited)A USB cable is required for initial application deployment; RhoStudio does not support deployment over Wi-Fi. |
CAUTION: When bringing up the Run Configurations screen, RhoStudio opens the most recenly used build config, which could cause you to mistakenly re-build the last app you were working on. A good practice is to name your build config after the app it builds, and always to confirm the selected build config before clicking 'Run.' |
When first launched, an app that has been properly modified for Live Update will display a message similar to the one below. The name of the example app is “Bloopy.”
This step establishes Wi-Fi communications between the development host and the device(s) that you want to receive Live Updates. After discovery, the dev host knows which devices to ‘notify’ of updates and the devices become ‘subscribers’ to an embedded web server page on the dev host for downloading update bundles.
With the modified app(s) running on the device(s):
dev-config.yml
will appear in the project.dev-config.yml
with the text editor and add ‘refresh: 1’ (not indented) after the device section(s) to enable Live Update for all devices
Congratulations! Your dev host and target device(s) are now ready to use Live Update. To test it, make an obvious change to any file in the app’s /app or /public folder and save it.
After a moment, your device(s) should display the change along with a message like the one below. In this case, the app name was changed from Bloopy to “WorkerBee.”
The first Live Update in a session could take several minutes to appear; subsequent updates generally occur after a few seconds. |
Live Update works with multiple devices simultaneously, as long as they’re among the discovered devices and have a Live Update-enabled app running.
A device that goes to sleep between Live Updates might become unresponsive or display errors on subsequent updates. First try killing and re-starting its app(s). If that fails, uninstall and redeploy the app(s).
An iPhone that is in sleep mode or has the Live Update app minimized will not be discovered.
To test apps for iOS, you must manually install your app from iTunes.
Changes to .rb
files might require the app(s) to be killed and restarted.
Here are some common problems and known issues of Live Update. If Live Update is not working for you, double-check the following first:
build.yml
file include the development extension?dev-config.yml
file contain ‘refresh:1 on a not-indented line?When a project is first created (but not yet built), the ‘build’ line in the build.yml
file looks like this:
build: debug
After the first build, it looks like this:
build: "debug"
* Changing “debug” to “release” declares a production build and removes the Live Update capability.
* Before (and after) your first build, your ‘extensions’ line should look like the correct one below. If it doesn’t, you might have forgotton to check “Use RhoElements” box when creating your project.
CORRECT: :::xml
... extensions: - rhoconnect-client - development
INCORRECT: :::xml
... extensions: ["rhoconnect-client"]
“ERROR when downloading or unpack[ing]”
POSSIBLE CAUSE
Network connectivity issueSOLUTION
Check that the device is on the same Wi-Fi subnet as the dev host; kill and re-launch the app; rebuild and redeploy the app.
“Your application files too old”
POSSIBLE CAUSE
Mutiple files are out of sync between the dev host and the deployed app.SOLUTION
When using auto update mode, do not attempt to make changes to a file without first saving previous changes and seeing them updated on the device. This problem can sometimes be solved by “Refreshing” the app (R-clicking on the project name and selecting “Refresh”) and applying an update with the full bundle. Otherwise, rebuild and redeploy the app.
“Error when update Bundle … replace bundle … unable to rename folder”
POSSIBLE CAUSE
This is a known issue in Live Update.Solution
On the device, go to Settings > Apps > (your app) and press the ‘Clear data’ and ‘Clear cache’ buttons. Then apply a full update or redeploy the app.
1- Open a Terminal window and make your project the current directory.
2- Discover devices on the current Wi-Fi subnet:
rake dev:network:discovery
If more than one subnet is present, you must specify which subnet to scan:
rake dev:network:discovery["192.168.1.*"]
If you don’t know whether more than one subnet is available, display a list…
rake dev:network:list
…and then use the ‘:discovery[“IP ADDRESS”]’ command above to specify which subnet to scan for subscribers.
3- Select subscribers using the following commands:
For Android:
rake run:android:device
For iOS:
rake run:ios:device
For Windows Mobile:
rake run:wm:device
4- To start the Webserver, open a new Terminal window, navigate to your project directory and enter:
rake dev:webserver:start
To Stop the Webserver
rake dev:webserver:stop
5- Select one of four Live Update modes of operation:
Partial Update packages the portions of a project that have changed and notifies devices that a download is available. This on-command feature works only from the command line and must be initialized before each debugging session. Use this mode when you want to make multiple changes and see them applied on command instead of each time a file is saved. rake dev:update:initialize rake dev:update:partial
Full Update packages all files in a project regardless of whether they’ve been changed and notifies devices. This on-command feature works only from the command line and does not require initialization.
rake dev:update:full
Auto Update monintors all files in a project and automatically packages the app and notifies devices every time changes are saved. This mode is invoked by pressing the ‘Enable Live Update’ button in the Live Update Settings page in RhoStudio or by using the CLI command below. It can be monitored or stopped from RhoStudio’s Progress tab, by pressing CTRL-C in webserver window, or by using the CLI commands below. rake dev:update:auto rake rev:update:auto:stop
Build and Notify mode is intended for use when integrating Live Update with an external build system and is a CLI-only feature. rake dev:update:build_and_notify
Live Update receives change info from two files stored in the project’s root level:
upgrade_package_add_files.txt
lists the project’s new or modified filesupgrade_package_remove_files.txt
lists files removed from the projectIt possible to build an application on one host platform and use it with Live Update on another. For example: an iOS application built on Mac OS X can be copied to a Windows development host for use with Live Update.
To do this, enter the following command on the second dev host before your first Partial Update:
rake dev:update:full
This will detect the connections and pathways for the new host computer and update your code accordingly.
If you’re taking a break from working on one app that uses Live Update and starting work on another, follow these steps to make Live Update work smoothly:
dev-config.yml
file for the correct app in its ‘application:’ line