Giter VIP home page Giter VIP logo

cordova-plugin-app-update's Introduction

travis

NPM

Code Sponsor

cordova-plugin-app-update

App updater for Cordova/PhoneGap

Demo

Try it yourself:

Just clone and install this demo. cordova-plugin-app-update-DEMO 🎉

  • 如果喜欢它,请别忘了给我一颗鼓励的星
  • Support me a Star if it is necessary. 👍

Preview

enter image description here

enter image description here

Install

Latest published version on npm (with Cordova CLI >= 5.0.0)

cordova plugin add cordova-plugin-app-update --save

Usage

  • Simple:
var updateUrl = "http://192.168.0.1/version.xml";
window.AppUpdate.checkAppUpdate(onSuccess, onFail, updateUrl);
  • Verbose
var appUpdate = cordova.require('cordova-plugin-app-update.AppUpdate');
var updateUrl = "http://192.168.0.1/version.xml";
appUpdate.checkAppUpdate(onSuccess, onFail, updateUrl);
  • Auth download MORE
appUpdate.checkAppUpdate(onSuccess, onFail, updateUrl, {
    'authType' : 'basic',
    'username' : 'test',
    'password' : 'test'
})

versionCode

You can simply get the versionCode from typing those code in Console

var versionCode = AppVersion.build
console.log(versionCode)  // 302048
versionName versionCode
0.0.1 18
0.3.4 3048
3.2.4 302048
12.234.221 1436218

server version.xml file

<update>
    <version>302048</version>
    <name>name</name>
    <url>http://192.168.0.1/android.apk</url>
</update>

checkAppUpdate code

    /**
     * 对比版本号
     */
    int VERSION_NEED_UPDATE = 201; //检查到需要更新; need update
    int VERSION_UP_TO_UPDATE = 202; //软件是不需要更新;version up to date
    int VERSION_UPDATING = 203; //软件正在更新;version is updating

    /**
     * 版本解析错误
     */
    int VERSION_RESOLVE_FAIL = 301; //版本文件解析错误 version-xml file resolve fail
    int VERSION_COMPARE_FAIL = 302; //版本文件对比错误 version-xml file compare fail

    /**
     * 网络错误
     */
    int REMOTE_FILE_NOT_FOUND = 404;
    int NETWORK_ERROR = 405;

    /**
     * 没有相应的方法
     */
    int NO_SUCH_METHOD = 501;

    /**
     * 未知错误
     */
    int UNKNOWN_ERROR = 901;

Languages

  • zh
  • en
  • de
  • fr
  • pt
  • bn
  • pl

Platforms

Android only

License

MIT

❄️ 🍻

  • Please let me know if you have any questions.

cordova-plugin-app-update's People

Contributors

arthursp avatar calcao avatar chaosnote avatar cperdereau avatar decpio avatar hodes avatar javierabrego avatar lancejenkinza avatar loban avatar oceantear avatar pxlrbt avatar timataran avatar vaenow avatar vovikdrg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.