This fork is ATM basically just a translation to english.
AppUpdater for Android is a lightweight open source library that focuses on app updates and integrates app version upgrades in one click for dummies.
There is no need to worry about various details and adaptation issues; including but not limited to: notification bar adaptation, duplicate downloads, file access authorization, app installation, etc.; all these AppUpdater have been taken care of for you.
- AppUpdater core library mainly includes app-updater and app-dialog.
app-updater is mainly responsible for downloading and updating apps in the background, so you don't need to worry about all kinds of configuration-related details when downloading, and upgrade in a foolproof way with one click.
app-dialog mainly provides commonly used Dialog and DialogFragment to simplify the implementation of pop-up box prompts, and the layout style can be freely customized.
- The reason why download update and popup dialog are separated is because they are two functions in the first place. They are completely independent, which can be decoupled and less intrusive at the same time.
If you only need to download and update apps, just rely on app-updater; If you need to download and update apps and also need dialogs to interact with them, then app-updater + app-dialog can be used in conjunction with app-updater and app-dialog.
- Focus on App Updates with One-Click Foolproof Upgrade
- Lightweight and small size.
- Support listen to download and customize download process.
- Support re-download when download fails.
- Supports MD5 verification to avoid duplicate downloads.
- Configurable notification content and flow.
- Support cancel download
- Support download using HttpsURLConnection or OkHttpClient.
- Support for Android 10(Q)
- Support for Android 11(R)
- Support for Android 12(S)
You can also download the demo app to experience the effect
-
Add the remote repository to build.gradle or setting.gradle in Project
repositories { //... mavenCentral() }
-
Add the dependencies to the Module's build.gradle.
//----------AndroidX version //app-updater implementation 'com.github.evermind-zz.AppUpdater:app-updater:1.2.0-1.2.0' //app-dialog implementation 'com.github.evermind-zz.AppUpdater:app-dialog:1.2.0-1.2.0'
// One line of code, update for dummies
new AppUpdater(getContext(),url).start();
// Simple popup box update
AppDialogConfig config = new AppDialogConfig(context);
config.setTitle(βSimple Popup Box Upgradeβ)
.setConfirm(βUpgradeβ) //old versions use setOk
.setContent(β1, add so-and-so function,\n2, modify so-and-so problem,\n3, optimize so-and-so bug,β)
.setOnClickConfirm(new View.OnClickListener() { // Older versions use setOnClickOk
@Override
public void onClick(View v) {
new AppUpdater.Builder(getContext())
.setUrl(mUrl)
.build()
.build() .start();
AppDialog.INSTANCE.dismissDialog();
}
});
AppDialog.INSTANCE.showDialog(getContext(),config);
//Simple DialogFragment upgrade
AppDialogConfig config = new AppDialogConfig(getContext());
config.setTitle("Simple DialogFragment Upgrade")
.setConfirm("Upgrade")
.setContent("1. Add a new function, \n2. Fix a problem, \n3. Optimize a bug, ")
.setOnClickConfirm(new View.OnClickListener() {
@Override
public void onClick(View v) {
AppUpdater appUpdater = new AppUpdater.Builder(getContext())
.setUrl(mUrl)
.build();
appUpdater.setHttpManager(OkHttpManager.getInstance()) // Download using OkHttp implementation
.setUpdateCallback(new UpdateCallback() { // Update callback
// Downloading: When isDownloading is true, it means that the download is already started,
// that is, the download has been started before; when it is false,
// it means that the download has not started yet and will start soon
@Override
public void onDownloading(boolean isDownloading) {
}
// start download
@Override
public void onStart(String url) {
}
// Download progress update: It is recommended to update the progress of the interface
// only when isChanged is true; because the actual progress changes frequently
@Override
public void onProgress(long progress, long total, boolean isChanged) {
}
// Download completed
@Override
public void onFinish(File file) {
}
// download failed
@Override
public void onError(Exception e) {
}
// Cancel download
@Override
public void onCancel() {
}
}).start();
AppDialog.INSTANCE.dismissDialogFragment(getSupportFragmentManager());
}
});
AppDialog.INSTANCE.showDialogFragment(getSupportFragmentManager(), config);
For more usage details, please check the source code usage examples in app or directly check the API help documentation
- When HttpManager is not set, HttpManager implemented by HttpsURLConnection is used for downloading by default. If you want to use OkHttpClient to implement downloading, you need to rely on the okhttp library; (HttpManager and OkHttpManager are provided by default internally)
- When supporting APK download, the local cache strategy is prioritized to avoid repeated downloading of the same APK file; (the verification method supports file MD5 or VersionCode comparison)
- If you need to customize the relevant text information in the notification bar when updating the App, you only need to define the same name in string.xml to overwrite it (the resource definitions in app-updater all start with app_updater).
- When Notification is not set, NotificationImpl is used by default. If the current layout of the notification bar does not meet your needs, you can refer to NotificationImpl to customize an INotification;
- AppUpdater logs are uniformly managed using LogUtils. LogUtils.setShowLog can be used to globally set whether to display logs. When you need to locate AppUpdater internal log information, you only need to filter the Log Tag that starts with AppUpdater.
- For more configuration instructions of AppUpdater, please see AppUpdater.Builder or UpdateConfig; the methods basically have detailed instructions.
- AppDialogConfig mainly provides some dialog configurations. It provides a set of default configurations internally. You can also customize the dialog configurations through AppDialogConfig's external exposure method; AppDialog is mainly responsible for the display and disappearance of the dialog box; through AppDialog and AppDialogConfig, you can easily implement a custom dialog box;
- AppDialog is general enough. It implements a set of most common dialog boxes and provides a series of default configurations, so that users can implement functions with as little configuration as possible. AppDialog is also abstract enough, and the layout style of the dialog box can be customized at will;
- Based on the above points, here is a special scenario description: If you do not want to define the dialog layout through a custom layout, and the default dialog text or button color does not meet your needs, and you only want to modify the color of the default dialog prompt text (including button text) in AppDialog, you can define the same name in colors.xml to override it (the resource definitions in app-dialog all start with app_dialog).
app-updater Proguard rules
app-dialog Proguard rules
compose-component A component library for Jetpack Compose; it mainly provides some small components for quick use.
- relay "Back" Buton pressed via onDismissListener for AppDialogFragment
- enclose TextView with ScrollView (for dialog content)
- translate README to english
- Updated Gradle to v7.3.3
- Optimize lint detection
- Optimize comments
- Optimize details
- Unified log management
- Compatible with Android 12(S)
- Optimize details
- AppDialog provides more configuration related to WindowManager.LayoutParams
- Provide more configurable parameters to the outside world
- Optimize details
- Subsequent versions only support androidx, and the version name no longer contains the androidx logo
- Optimize details
- Migrate and publish to Maven Central
- AppDialogConfig adds construction parameters to simplify custom extension usage
- Optimize details
- Optimize the display details of the default Dialog style
- Support MD5 verification
- Provide external access to Dialog methods
- Optimize details
- Added OkHttpManager. If you use OkHttpManager, you must rely on okhttp
- Optimization details (progress, total changed from int -> long)
- Support cancel download
v1.0.4: 2019-6-4 Started to support AndroidX version
- Support adding request headers
- Added support for downloading APKs with priority to local cache to avoid downloading the same version of APK files multiple times
- AppDialog supports hiding the Dialog title
- Added new settings for whether the notification bar should vibrate and ring tone
- AppDialogConfig adds getView(Context context) method
- Upgrade Gradle to 4.6
- AppUpdater initial version
If you like AppUpdater, or feel that AppUpdater has helped you, you can click the "Star" in the upper right corner to support it. Your support is my motivation. Thank you π
You can also scan the QR code below to buy the author a cup of coffee β
My Blog | GitHub | Gitee | CSDN | Blog Garden |
---|---|---|---|---|
Jenly's Blog | jenly1314 | jenly1314 | jenly121 | jenly |
WeChat public account | Gmail mailbox | QQ mailbox | QQ group | QQ group |
---|---|---|---|---|
Jenly666 | jenly1314 | jenly1314 | 20867961 | 64020761 |