Android Apk检查更新升级工具
在Android Studio的Project build.gradle中加入:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
在Module build.gradle中添加依赖:
implementation 'com.github.LanceShu:upgrade-apk-util:1.2'
ApkUpgradeManager manager = ApkUpgradeManager.getManager(context);
String version = manager.getAPKVersionName(getPackageName());
int code = manager.getAPKVersionCode(getPackageName());
manager.downloadAPK(httpUrl, "parentPath", "apkName.apk");
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>