Check Version |
Download APK |
Install |
Dwonload Error |
![Live Demo](https://camo.githubusercontent.com/6d2b60844af5d526bf3f96e665bb7531aca3d41581adf8b1bf462424460e6b1f/687474703a2f2f7777772e6873756e6170692e67612f696d616765732f4170705570646174657244656d6f2e676966) |
![Download APK](https://camo.githubusercontent.com/0c6e85699c62a162c07d9dff49f03a1835f7f7868e5ca1fb278fbecd5fbb0d42/687474703a2f2f7777772e6873756e6170692e67612f696d616765732f4170705570646174657244656d6f5f322e706e67) |
![Install](https://camo.githubusercontent.com/0e15635bdad1e1047554d684f60fc8d4c9eb9b9b034005b2e162561dce75554a/687474703a2f2f7777772e6873756e6170692e67612f696d616765732f4170705570646174657244656d6f5f332e706e67) |
![Dwonload Error](https://camo.githubusercontent.com/4db6400e85ee7f5b6b6631f22e6e382be51acf673085e2e2e7f7bb4f2e1c83a0/687474703a2f2f7777772e6873756e6170692e67612f696d616765732f4170705570646174657244656d6f5f342e706e67) |
Device |
Adroid API |
Type |
Nokia 7+ |
28 |
Real |
Samsung Galaxy S8 |
28 |
Real |
Samsung Galaxy S9+ |
26 |
Real |
Xperia XZ1 Compact |
26 |
Real |
Huawei Mate 9 |
24 |
Real |
LG G6 |
24 |
Real |
Xiaomi Mix2 |
26 |
Real |
ASUS Zenfone 5 |
20 |
Real |
Device |
Adroid API |
Type |
Pixel 2 |
26 |
Virtual |
Pixel 2 |
28 |
Virtual |
Nexus 4 |
22 |
Virtual |
Nexus 5 |
19 |
Virtual |
Nexus 5X |
25 |
Virtual |
Nexus 6 |
24 |
Virtual |
Nexus 6P |
27 |
Virtual |
Nexus 7 (2012) |
22 |
Virtual |
Nexus 9 |
25 |
Virtual |
Nexus 10 |
22 |
Virtual |
(1) Gradle (This lib use dataBinding, Plz add dataBinding enabled = true)
![](https://camo.githubusercontent.com/202629ae79d2db442ee862f7dd737a1f837db578c56f9ea7099efd8304908b24/68747470733a2f2f6a69747061636b2e696f2f762f4873756e547361692f6170702d757064617465722e737667)
android {
...
repositories {
maven { url 'https://jitpack.io' }
}
dataBinding {
enabled = true
}
...
}
dependencies {
implementation 'com.github.HsunTsai:app-updater:1.0.2'
}
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Add uses-library & provider in your
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<provider
android:name="com.hsun.appupdater.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/update_apk_paths" />
</provider>
You need a backend server(API) to tell the version number that the application wants to upgrade.
{
"version": "1.0.1",
"versionCode": "2",
"apkUrl": "https://www.hsunserver.ga/download/appUpdater_2_1.0.1.apk",
"updateInformation": "●Your information 1\n●Your information 2\n●Your information 3",
"releaseTime": 1551059568060,
"appSize": 12806567,
"constraint": true
}
public void checkVersion(){
AppUpdaterDialogSettings appUpdaterDialogSettings = new AppUpdaterDialogSettings();
appUpdaterDialogSettings
.setUpdateInfoTextResource(R.string.update_info_text) // auto replact ${version} to your new version
.setDownloadBtnTextResource(R.string.hint_open_browser) // default value => 'open browser to download APK'
.setUpdateBtnTextResource(R.string.common_update) // default value => 'Update'
.setDialogThemeColor("#0087DC"); // default value => '#4DB6AC'
new AppUpdater(MainActivity.this)
.setVersion(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)
.setUpdateParam("https://www.hsunserver.ga/download/updateData.json")
//.setUpdateParam("https://www.hsunserver.ga/download/updateData.json", AppUpdater.RequestMethod.GET)
//.setUpdateParam("https://www.hsunserver.ga/download/updateData.json", AppUpdater.RequestMethod.POST, data)
//.setLogShow(true)
.setDialogSettings(appUpdaterDialogSettings)
.run();
}
Created by MVVM pattern
Volley