The Zyah Auto Update Utility
The Only Constant Is Change
How many apps do you have installed that have never received an update? We’re willing to bet that number is pretty low. Your banking app needed to apply a security patch, your streaming app improved its suggestions algorithm, your food delivery app improved its search UI. It’s the norm for software to be updated to better meet user needs.
At Zyah Solutions we’re in the business of delivering custom software to clients and we want that process of continuous improvement to be as seamless for the end user as possible. So what does our update process look like?
Tell us if this sounds familiar. In order to deliver your LabVIEW-based updates to your client, you zip it up and then either email them the file directly (file size is often an issue with this approach) or you put it on some file hosting service (e.g. OneDrive, Dropbox, Google Drive, etc.) and share a link to the new installer. That method is serviceable, but it puts the onus on the end user to perform the update. And if they miss the email, they might not even know an update is available. There are some good ways to programmatically notify users of updates, but can we go that last mile? Why are applications built with LabVIEW any different than other modern programs that automatically check for their own updates and apply them with minimal user interaction?
Introducing the Zyah Auto Update Utility
The Zyah Auto Update Utility aims to provide an API that makes automatic application updates easier for LabVIEW-based development. It makes heavy use of the NI Package Manager and its API and assumes you make use of NI Packages for deployment. (If you haven’t used NI Packages before, they’re much like the “Installer” build specs in LabVIEW projects and you can easily make the switch.)
Usage
We will review the API details shortly, but first a high-level overview of a typical use scenario.
At Zyah we use this utility and its API calls in the following (general) manner:
We setup an NIPM feed to host our application’s updates. You can read more about how to do this on the NI Package Management Portal or you can contact us for assistance.
Our application calls Register NIPM Feed to register to our package feed.
Once the feed is registered, the application calls Check for Package Update to check if an update is available.
If an update is available and the user chooses to apply it, we use Launch Updater EXE to run the separate updater EXE and the main application is shut down.
We wait for the main application to shutdown (via the Wait for App Shutdown API).
The updater then uses Update NI Package to update main application via the latest NI Package from our feed.
The updater uses Launch App EXE to restart the main application.
Finally, the updater shuts itself down.
Because the utility is a class and not tied to any particular architectural implementation, you can use it with Actor Framework, DQMH modules, JKI SMOs or any other framework you can think of.
API
Auto Update Utility Palette
Installing the Zyah Auto Update Utility will make the palette shown above accessible in the IDE (LabVIEW 2020+). Here’s a list of some of the key APIs:
Register NIPM Feed: Registers an NI Package Manager feed if not already registered. Does nothing if the feed is already registered). If there is a problem with the feed URI, an error will be generated.
Check for Package Update: Checks the registered feed to see if an NI Package update is available and prompt the user to proceed with the update if it is.
Update NI Package: Attempts to update the NI Package and reports the results.
Wait for App Shutdown: Waits for the main application process to shut down. If, within the specified time, it does not, an error is generated.
Launch Updater EXE: Launches a separate EXE to update the main application NI Package.
Launch App EXE: Launches the main application EXE. (Usually used after a successful NI Package update.)
Closing Notes
Because utility is a developer tool, we do not dictate how to use it in your own application, but here are some recommendations and notes to help you along:
You cannot apply the update for an NI Package if that package updates an EXE that is currently running. So how do you use NI Packages to update your own application? As implied in the “Usage” section, one workaround is to create two EXEs for your given application. The first is the normal EXE that you would distribute to clients. The second is an updater EXE that actually applies the main NI Package update. When you first deliver your program, you would need to deliver both packages, but from then on, you would only need to deliver updates to the main NI Package to your feed.
This particular blog post does not focus on hosting NI Package feeds but know that it can be done locally (on your own computer or network) or on a cloud-based service like AWS S3. For more information on NI Package feeds as well as NIPM and the packages themselves, check out some of the resources on the NI Package Management Portal or contact us.
We hope this utility makes it easier for you to deliver more professional-looking updates to your clients’ applications!
Where to Get It
VIPM (VI package) - https://www.vipm.io/package/zyah_solutions_lib_zyah_auto_update_utility/
GitLab (source) - https://gitlab.com/zyah-solutions/community-tools/zyah-auto-update-utility