How to trigger an app update in Cordova programmatically

There might be situation where we can’t use the automatic update feature of app stores provided by mobile platforms. Recently i came across similar situation. The app is built on Cordova.

The app checks for new version and prompt user to update when the app starts if any update is available. The app in our device compares the version in the app to the version of apk stored in the server. If the versions don’t match, new apk is downloaded and installed. Cordova uses File Api  and the WebIntent plugin to implement this. The code downloads the apk from the server to local storage and then triggers the install. The below code may not work in nougat if the target sdk version is more than 23. To make it work , target sdk should be 23 or below.

 

Add a Comment

Your email address will not be published. Required fields are marked *