Android-App Detection Upgrade Library


For Android App detection of automatic updates

Achieving results

Add Dependency

    implementation 'com.xwdz:QuiteVersion:0.0.4'
    implementation 'com.xwdz:okHttpUtils:1.0.4'
    //Ignorable if dependent
    implementation 'com.squareup.okhttp3:okhttp:3.5.0'


  • Callable anywhere
  • Support for custom interfaces
  • Supports forced download of the latest Apk
  • Self-starting installation interface
  • simple
  • Supports OKHttp interceptors
  • Adaptation 7.0

Simple use

    DialogTest dialogTest = DialogTest.newInstance();
                //or POST
                //Force each update to download the latest Apk from the network
                //UI container needs to implement OnUINotify interface
                .setOnNetworkParserListener(new OnNetworkParserListener() {
                    public ApkSource parser(String response) {
                        return new ApkSource(
                                "The updates are as follows\n1.Hello\n2.My bad",


Be careful

The developer must implement this interface to return the Apk information required by QuiteVersion, and if null is returned, it is considered that there is no new version update

setOnNetworkParserListener(new OnNetworkParserListener() {
                          public ApkSource parser(String response) {
                              return null;

QuiteVersion executes update App policy

  • ApkSource.remoteVersionCode > current version code
  • todo

setApkName and setApkPath description

  • QuiteVersion default implementation path is context.getExternalFilesDir("apk").getAbsolutePath() + File.separator + apkFilename

  • QuiteVersion default implementation file name is Url last/to.apk, such as cool dog
    ApkName is kugou_android.apk

Custom Container Dialog

1. Inherit AbstractActivity to implement your own UI, override the following three methods, and inject through setShowUIActivity(xxx.class).

//UI layout defined by oneself
public abstract int getContentLayoutId();
//Data Initialization
public abstract void setUpData();
//Callback to this method when performing download tasks
public abstract void updateProgress(int percent, long currentLength, long total);

Default ProgressDialogActivity It is also based on this implementation.
The updated text is available through String note = getIntent().getStringExtra("note").

2. Implement OnUINotify interface
Default implementation without specifying the.setNotifyHandler() method and ``setShowUIActivity'method refers to the beginning of the article`

Implement this interface in a custom container and call the real show method in the interface method show. See simple-code for details

Note: Custom containers can only be used in one way.

In the custom container, when you click to start downloading, you need to call the following code


Register Accept Download Progress Bar Component in Custom Container

private final VersionHandler.ProgressReceiver mProgressReceiver = new VersionHandler.ProgressReceiver() {
        public void onUpdateProgress(long total, long currentLength, int percent) {
            Utils.LOG.i("tag", "current = " + currentLength);

//Call registration code when appropriate for container creation
VersionHandler.registerProgressbarReceiver(getContext(), mProgressReceiver);

//Call logout code when container is destroyed
VersionHandler.unregisterProgressbarReceiver(getContext(), mProgressReceiver);

@pickle xwdz


Keywords: OkHttp Android network github

Added by trilbyfish on Fri, 06 Mar 2020 18:09:52 +0200