Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/azhon/AppUpdate
Android App update library. Android版本更新库,简单、轻量、可随意定制
https://github.com/azhon/AppUpdate
android apk app-update high-scalability kotlin kotlin-coroutines simple
Last synced: 3 months ago
JSON representation
Android App update library. Android版本更新库,简单、轻量、可随意定制
- Host: GitHub
- URL: https://github.com/azhon/AppUpdate
- Owner: azhon
- License: apache-2.0
- Created: 2018-01-29T10:13:18.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-10-25T02:45:43.000Z (3 months ago)
- Last Synced: 2024-10-26T16:21:28.899Z (3 months ago)
- Topics: android, apk, app-update, high-scalability, kotlin, kotlin-coroutines, simple
- Language: Kotlin
- Homepage:
- Size: 38.3 MB
- Stars: 2,302
- Watchers: 44
- Forks: 337
- Open Issues: 0
-
Metadata Files:
- Readme: README-EN.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
## [中文 文档](https://github.com/azhon/AppUpdate/blob/main/README.md)
## The core logic of this library:
#### 1、When `apkVersionCode()` is set the latest VersionCode, it will automatically judge whether to display the dialog, download and install
- Adapt to Android 13 notification permission, and when set `showNotification(true)`, clicking the upgrade button will request notification permission, and the download will continue regardless of whether you agree or not
- When set `forcedUpgrade(true)`,display dialog has progress bar
#### 2、When `apkVersionCode()` is not set, it can be regarded as a downloader, which will only download and install
#### 3、Since Android Q version restricts background apps from launching Activity, a notification will be sent to the notification bar when the download is complete (ignoring the showNotification value, you need to allow notifications to be sent)
#### 4、[For more usage,click here](https://github.com/azhon/AppUpdate/blob/main/app/src/main/java/com/azhon/app/MainActivity.kt#L79)### Related Docs Links
- [Activity background starts](https://developer.android.google.cn/guide/components/activities/background-starts)
- [Adapt notification](https://developer.android.google.cn/guide/topics/ui/notifiers/notifications?hl=zh-cn)## Table of Contents
* Rendering
* Function introduction
* Demo download experience
* Steps for usage
* Skills
* Version update record
* End### Rendering
### Function introduction
* [x] Support Java、Kotlin
* [x] Support AndroidX
* [x] Support for custom download process
* [x] Support Android 4.1 and above
* [x] Support notification progress display, adapt to Android 13
* [x] Support Chinese/Traditional/English
* [x] Support for custom built-in dialog styles
* [x] Support for canceling the download (if the notification bar message is sent, it will be removed)
* [x] Support download completion Delete old APK file after opening new version
* [x] Download using HttpURLConnection, no other third-party framework is integrated### [Demo download experience](https://github.com/azhon/AppUpdate/releases/tag/demo)
### Steps for usage
#### Step1:`app/build.gradle`
```groovy
implementation 'io.github.azhon:appupdate:4.3.6'
```Since in-app updates are prohibited by GooglePlay policy, it can be handled in productFlavors
- [GooglePlay policy](https://support.google.com/googleplay/android-developer/answer/9888379?hl=en&ref_topic=9877467)
- Library provides a version without no operation[Click see more](https://github.com/azhon/AppUpdate/blob/main/app/build.gradle)
```groovy
android {
//...
productFlavors {
other {}
googlePlay {}
}
}dependencies {
otherImplementation 'io.github.azhon:appupdate:latest-version'
googlePlayImplementation 'io.github.azhon:appupdate-no-op:latest-version'
}
```#### Step2:Create `DownloadManager`
Kotlin
```java
val manager = DownloadManager.Builder(this).run {
apkUrl("your apk url")
apkName("appupdate.apk")
smallIcon(R.mipmap.ic_launcher)
//If this parameter is set, it will automatically determine whether to show dialog
apkVersionCode(2)
apkVersionName('v4.2.2')
apkSize("7.7MB")
apkDescription("description...")
//Optional parameters...
build()
}
manager?.download()
```Java
```java
DownloadManager manager = new DownloadManager.Builder(this)
.apkUrl("your apk url")
.apkName("appupdate.apk")
.smallIcon(R.mipmap.ic_launcher)
//If this parameter is set, it will automatically determine whether to show dialog
.apkVersionCode(2)
.apkVersionName("v4.2.2")
.apkSize("7.7MB")
.apkDescription("description...")
//Optional parameters...
.build();
manager.download();
```#### Step3:ProGuard Rules
```groovy
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Service
```### Skills
* Internationalization support, other languages only need to take the same name in the corresponding `string.xml`
* To view the Log, you only need to filter the Tag at the beginning of `AppUpdate`
* Download completed Delete old APK file after opening new version```java
//Old version apk file save path
val result = ApkUtil.deleteOldApk(this, "${externalCacheDir?.path}/appupdate.apk")
```* Tips: The contents of the upgrade dialog can be swiped up and down!
* If you need to implement your own set of download process, you only need to `extends` `BaseHttpDownloadManager`.```java
class MyDownload : BaseHttpDownloadManager() {}
```### Version update record
* v4.3.6(2024/10/22)
* [Opt] Change DownloadManager release() to public
#### [More update records click here to view](https://github.com/azhon/AppUpdate/wiki/Home)
### End
* If you encounter problems during use, please feel free to ask Issues.
* If you have any good suggestions, you can also mention Issues or send email to: [email protected].