1 Star 0 Fork 0

DeathsWaltz / cordova-plugin-android-update

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

文章版权声明:https://blog.csdn.net/qq_23179075/article/details/86581672

cordova-plugin-android-update

App updater for Cordova/PhoneGap

本插件在 cordova-plugin-app-update 的基础上修改的,主要修改内容:

  1. 修改了更新提示框样式(网易云音乐APP样式)
  2. 提示框中加入了更新详情。
  3. 在原插件配置文件中加入了 <remark></remark> 标签,来配置更新内容提示。

Demo

Try it yourself:

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

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

Preview

在这里插入图片描述

在这里插入图片描述

Install

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

"cordova-android": "6.3.0"

cordova plugin add https://github.com/azhengyongqin/cordova-plugin-android-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'
})
  • Skip dialog boxes
appUpdate.checkAppUpdate(onSuccess, onFail, updateUrl, {
    'skipPromptDialog' : true,
    'skipProgressDialog' : true
})

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>10200</version>
    <name>1.2.0</name>
    <remark>1.加入自动升级功能\n2.修复了一些bug\n3.不用扫描下载了</remark>
    <url>http://http://192.168.0.1/android.ap</url>
</update>

在原插件配置文件中加入了 <remark></remark> 标签,来配置更新内容提示。

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;

    /**
     * Permissions
     */
    int PERMISSION_DENIED = 601;

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

Languages

  • 🇨🇳 zh
  • 🇺🇸 en
  • 🇩🇪 de
  • 🇫🇷 fr
  • 🇵🇹 pt
  • 🇧🇩 bn
  • 🇵🇱 pl
  • 🇮🇹 it
  • 🇪🇸 es
  • 🇷🇺 ru
  • 🇰🇷 ko

Platforms

Android only

License

MIT

:snowflake: :beers:

The MIT License (MIT) Copyright (c) 2015 Wen Luo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
Java 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/deathsw/cordova-plugin-android-update.git
git@gitee.com:deathsw/cordova-plugin-android-update.git
deathsw
cordova-plugin-android-update
cordova-plugin-android-update
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891