When the device is connected to the network, it reads the metadata file and determines whether it has an update. If there is an update, the 'Update' button will be shown in the header next to the 'Sync' button. The offlineMetadata.json is present at `/var/www/html/offlineMetadata.json'.
There are two kinds of updates:
Forced update/Hard Update - this means that the version installed on the device is not compatible with the server and it needs to be upgraded for the data to get synced to server. In this case, each time the app tries to sync the data to the server, it shows a popup with a link/button to upgrade the app.
Non-forced update/Soft Update - this means that the version installed on the device is still compatible with the server and it need not be upgraded immediately to get the data synced. In this case, sync happens smoothly even if the app is not upgraded.
Upgrading the Android App
For the Android app, the 'latestAndroidAppUrl' in the offlineMetadata.json contains the url of latest apk released. On clicking the Update button, the apk is downloaded from the specified url in offlineMetadata.json and installed automatically.
In order to get the version information can be found under Settings→ Application Manager→ Bahmni. The version information is bundled into the apk and thus, static in nature.
Upgrading the Chrome App
For the Chrome app, the 'latestChromeAppUrl' in the offlineMetadata.json contains the url from where the chrome extension tar file can be downloaded. On clicking the Update button, the link with the url is shown so that the extension can be downloaded and installed manually.
Connect version information can be seen post the extension is added to chrome i.e. it shows up alongside the extension name. Moreover, if the user navigates to the extension folder, the manifest.json file will have version defined, which is used for version information.
"description": "Bahmni is an easy to use, open source hospital system for healthcare providers in low-resource settings. Brought to you by Bahmni Coalition under fiscal sponsorship of OpenMRS.",
"key" : "akgemjphbnkkphopcgfjplhfemmgfolc",
"content_security_policy": "script-src 'self' https://dev.bahmnidev.org 'unsafe-eval'; object-src 'self'"
To install the extension manually, the tar file has to be unzipped and put in the location from where the extension is loaded.
The extension should not be deleted from the Chrome browser to update the app. Deleting the extension deletes the data as well.