# android-autoupdater **Repository Path**: xiaomitop/android-autoupdater ## Basic Information - **Project Name**: android-autoupdater - **Description**: android lib -autoupdater - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2015-04-16 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #android-autoupdater [![Build Status](https://travis-ci.org/SnowdreamFramework/android-autoupdater.svg?branch=master)](https://travis-ci.org/SnowdreamFramework/android-autoupdater) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.snowdream.android.app/updater/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.snowdream.android.app/updater) [![Pledgie](https://pledgie.com/campaigns/27475.png)](https://pledgie.com/campaigns/27475) ##Introduction android lib - autoupdater ##Demo [Github][0] [Google Play][1] ##Preview ![main](docs/preview/main.png "main") ![checking](docs/preview/checking.png "checking") ![update](docs/preview/update.png "update") ![download](docs/preview/download.png "download") ![upgrade](docs/preview/upgrade.png "upgrade") ##Specifications [Android Autoupdate Specification V1.0](docs/specifications/spec1.0.md) ##System requirements Android 2.2+ ##Permission requirements ```xml ``` ##Dependencies 1. Google Gson [https://code.google.com/p/google-gson/](https://code.google.com/p/google-gson/) 2. http-request [https://github.com/kevinsawicki/http-request](https://github.com/kevinsawicki/http-request) 3. android-autoupdater [https://github.com/snowdream/android-autoupdater](https://github.com/snowdream/android-autoupdater) 4. android-downloader [https://github.com/snowdream/android-downloader](https://github.com/snowdream/android-downloader) 5. android-multithread [https://github.com/snowdream/android-multithread](https://github.com/snowdream/android-multithread) Check this for more informaion. [build.gradle](https://github.com/snowdream/android-autoupdater/blob/master/client/build.gradle) ##Download Download [the latest aar][2] or grab via Maven: ```xml com.github.snowdream.android.app updater 1.0 aar ``` or Gradle: ```groovy compile ('com.github.snowdream.android.app:updater:1.0@aar'){ transitive=true } ``` ##Usage 1、upload the new apk to the webserver,get the apk url,as follows. ```html https://raw.github.com/snowdream/android-autoupdate/master/docs/test/android-autoupdater-v2.0-release.apk ``` 2、read [Android Autoupdate Specification V1.0](docs/specifications/spec1.0.md) then touch the file update.xml ```xml android-autoupdater android autoupdater com.github.snowdream.android.apps.autoupdater 2 2.0 false false https://raw.github.com/snowdream/android-autoupdate/master/docs/test/android-autoupdater-v2.0-release.apk update tips update tips 升级提示\n1.版本检查\n2.版本维护\n3.版本更新 升级提示 升级提示 升级提示 ``` 3、upload the update.xml to the webserver,get the file url,as follows. ```html 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. ```java 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 ```java 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) 2014 Snowdream Mobile 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. ``` [0]:https://raw.github.com/snowdream/android-autoupdater/master/docs/test/android-autoupdater-v1.0-release.apk [1]:https://play.google.com/store/apps/details?id=com.github.snowdream.android.apps.autoupdater [2]:https://oss.sonatype.org/content/groups/public/com/github/snowdream/android/app/updater/1.0/updater-1.0.aar