The offline metadata file present on the server decides whether the Bahmni Connect app in the devices needs to be upgraded or not.
The offline metadata file looks like this:
"compatibleVersions": [0.79, 0.80]
The offlineMetadata.json will be present in `/var/www/html/offlineMetadata.json'.
When the device is connected to network, it reads the metadata file and determines whether it has a update. If there is an update, 'Update' button will be shown in the header next to 'Sync' button.
There are two kinds of update:
- Forced update - this means that installed version in device is not compatible with 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 data to the server, it shows a popup which has link/button to upgrade the app.
- Non-forced update - this means that installed version in device is still compatible with server and it need not be upgraded immediately to get data synced. In this case, sync happens smoothly even if app is not upgraded.
For android app, the 'latestAndroidAppUrl' in the offlineMetadata.json contains the url of latest apk released. On clicking on Update button, the apk is downloaded from the specified url in offlineMetadata.json and installed automatically.
For 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 extension can be downloaded and installed manually.
To install the extension manually, the tar file has to be unzipped and put in the location from where extension is loaded.
Note: Extension should not be deleted from chrome browser to update the app. Deleting the extension deletes the data as well.