App Update
This plugin does self-update for android
Repo: https://github.com/vaenow/cordova-plugin-app-update
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-plugin-app-update $ npm install --save @ionic-native/app-update@4
- Add this plugin to your app's module
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';
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.
Instance Members
checkAppUpdate(updateUrl, options)
Check and update
Param | Type | Details |
---|---|---|
updateUrl |
string
|
update api url |
options |
AppUpdateOptions
|
optionsOptional |
Returns: Promise<any>
Returns a promise that resolves when something happens
AppUpdateOptions
Param | Type | Details |
---|---|---|
authType |
string
|
|
username |
string
|
(optional) |
password |
string
|
(optional) |