Code Monkey home page Code Monkey logo

android-autoupdater's Introduction

#android-autoupdater

##Introduction android lib - autoupdater

##Demo Github
Google Play

##Preview main checking update download upgrade

##Specifications Android Autoupdate Specification V1.0

##System requirements Android 2.2+

##Download Download the latest aar or grab via Maven:

<dependency>
  <groupId>com.github.snowdream.android.app</groupId>
  <artifactId>updater</artifactId>
  <version>1.0</version>
  <type>aar</type>
</dependency>

or Gradle:

    compile 'com.github.snowdream.android.app:updater:1.0@aar'

##Usage 1、upload the new apk to the webserver,get the apk url,as follows.

https://raw.github.com/snowdream/android-autoupdate/master/docs/test/android-autoupdater-v2.0-release.apk

2、read Android Autoupdate Specification V1.0 then touch the file update.xml

<?xml version="1.0" encoding="UTF-8"?>
<updateInfo>
    <appName>android-autoupdater</appName>
    <appDescription>android autoupdater</appDescription>
    <packageName>com.github.snowdream.android.apps.autoupdater</packageName>
    <versionCode>2</versionCode>
    <versionName>2.0</versionName>
    <forceUpdate>false</forceUpdate>
    <autoUpdate>false</autoUpdate>
    <apkUrl>https://raw.github.com/snowdream/android-autoupdate/master/docs/test/android-autoupdater-v2.0-release.apk</apkUrl>
    <updateTips>
        <default>update tips</default>
        <en>update tips</en>
        <zh>升级提示\n1.版本检查\n2.版本维护\n3.版本更新</zh>
        <zh_CN>升级提示</zh_CN>
        <zh_TW>升级提示</zh_TW>
        <zh_HK>升级提示</zh_HK>
    </updateTips>
</updateInfo>

3、upload the update.xml to the webserver,get the file url,as follows.

https://raw.github.com/snowdream/android-autoupdate/master/docs/test/updateinfo.xml

4、get the lib in you project. write this into the build.gradle.

    compile 'com.github.snowdream.android.app:updater:1.0@aar'

5、where you want to check update,write as follows.

UpdateManager manager = new UpdateManager(this);

UpdateOptions options = new UpdateOptions.Builder(this)
        .checkUrl("https://raw.github.com/snowdream/android-autoupdate/master/docs/test/updateinfo.xml")
        .updateFormat(UpdateFormat.XML)
        .updatePeriod(new UpdatePeriod(UpdatePeriod.EACH_TIME))
        .checkPackageName(true)
        .build();
manager.check(this, options);

or

UpdateManager manager = new UpdateManager(this);

UpdateOptions options = new UpdateOptions.Builder(this)
        .checkUrl("https://raw.github.com/snowdream/android-autoupdate/master/docs/test/updateinfo.xml")
        .updateFormat(UpdateFormat.XML)
        .updatePeriod(new UpdatePeriod(UpdatePeriod.EACH_TIME))
        .checkPackageName(true)
        .build();

manager.check(this, options,new AbstractUpdateListener() {
            /**
             * Exit the app here
             */
            @Override
            public void ExitApp() {

            }

            /**
             * show the update dialog
             *
             * @param info the info for the new app
             */
            @Override
            public void onShowUpdateUI(UpdateInfo info) {

            }

            /**
             * It's the latest app,or there is no need to update.
             */
            @Override
            public void onShowNoUpdateUI() {

            }

            /**
             * show the progress when downloading the new app
             *
             * @param info
             * @param task
             * @param progress
             */
            @Override
            public void onShowUpdateProgressUI(UpdateInfo info, DownloadTask task, int progress) {

            }

            /**
             * show the checking dialog
             */
            @Override
            public void onStart() {
                super.onStart();
            }

            /**
             * hide the checking dialog
             */
            @Override
            public void onFinish() {
                super.onFinish();
            }
        });

##License

Copyright (C) 2013 Snowdream Mobile <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

android-autoupdater's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.