Search docs/

App Update

This plugin does self-update for android

https://github.com/vaenow/cordova-plugin-app-update

Stuck on a Cordova issue?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Contact Us Today!

Installation

ionic cordova plugin add cordova-plugin-app-updatenpm install @ionic-native/app-update
Ionic Native Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us

Supported Platforms

  • Android

Usage

You should first host an XML file on your server with the following data in it:

<update>
    <version>302048</version>
    <name>APK Name</name>
    <url>https://your-remote-api.com/YourApp.apk</url>
</update>

Then use the following code:

import { AppUpdate } from '@ionic-native/app-update/ngx';

constructor(private appUpdate: AppUpdate) {

   const updateUrl = 'https://your-remote-api.com/update.xml';
   this.appUpdate.checkAppUpdate(updateUrl).then(() => { console.log('Update available') });

}

The plugin will compare the app version and update it automatically if the API has a newer version to install.