docs(app-update): add docs

This commit is contained in:
Ibby 2017-03-01 20:33:21 -05:00
parent 91ee5bde5f
commit 13484f9843

View File

@ -6,21 +6,33 @@ import { Plugin, Cordova } from './plugin';
* This plugin does self-update for android * This plugin does self-update for android
* *
* @usage * @usage
*
* You should first host an XML file on your server with the following data in it:
* ```xml
* <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'; * import { AppUpdate } from 'ionic-native';
* *
* let updateUrl = 'http://your-remote-api'; * let updateUrl = 'http://your-remote-api.com/update.xml';
* AppUpdate.checkAppUpdate(updateUrl) *
* .then((something: any) => doSomething(something)) * AppUpdate.checkAppUpdate(updateUrl);
* .catch((error: any) => console.log(error));
* ``` * ```
*
* The plugin will compare the app version and update it automatically if the API has a newer version to install.
*/ */
@Plugin({ @Plugin({
pluginName: 'AppUpdate', pluginName: 'AppUpdate',
plugin: 'cordova-plugin-app-update', plugin: 'cordova-plugin-app-update',
pluginRef: 'AppUpdate', pluginRef: 'AppUpdate',
repo: 'https://github.com/vaenow/cordova-plugin-app-update', repo: 'https://github.com/vaenow/cordova-plugin-app-update',
install: 'ionic plugin add cordova-plugin-app-update --save',
platforms: ['Android'] platforms: ['Android']
}) })
export class AppUpdate { export class AppUpdate {