优化细节

android
Jenly 4 years ago
parent 0f335e154b
commit 6d6848ed94
  1. 2
      app-updater/src/main/java/com/king/app/updater/AppUpdater.java
  2. 8
      app/src/main/java/com/king/appupdater/MainActivity.java

@ -158,7 +158,7 @@ public class AppUpdater {
* @param url 下载地址 * @param url 下载地址
* @return * @return
*/ */
public Builder serUrl(@NonNull String url){ public Builder setUrl(@NonNull String url){
mConfig.setUrl(url); mConfig.setUrl(url);
return this; return this;
} }

@ -137,7 +137,7 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
mAppUpdater = new AppUpdater.Builder() mAppUpdater = new AppUpdater.Builder()
.serUrl(mUrl) .setUrl(mUrl)
.build(getContext()) .build(getContext())
.setUpdateCallback(new AppUpdateCallback() { .setUpdateCallback(new AppUpdateCallback() {
@Override @Override
@ -188,7 +188,7 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
mAppUpdater = new AppUpdater.Builder() mAppUpdater = new AppUpdater.Builder()
.serUrl(mUrl) .setUrl(mUrl)
.build(getContext()); .build(getContext());
mAppUpdater.start(); mAppUpdater.start();
AppDialog.INSTANCE.dismissDialog(); AppDialog.INSTANCE.dismissDialog();
@ -221,7 +221,7 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
mAppUpdater = new AppUpdater.Builder() mAppUpdater = new AppUpdater.Builder()
.serUrl(mUrl) .setUrl(mUrl)
// .setPath(Environment.getExternalStorageDirectory() + "/.AppUpdater")//如果适配Android Q,则Environment.getExternalStorageDirectory()将废弃 // .setPath(Environment.getExternalStorageDirectory() + "/.AppUpdater")//如果适配Android Q,则Environment.getExternalStorageDirectory()将废弃
// .setPath(getExternalFilesDir(Constants.DEFAULT_DIR).getAbsolutePath())//自定义路径,推荐使用默认 // .setPath(getExternalFilesDir(Constants.DEFAULT_DIR).getAbsolutePath())//自定义路径,推荐使用默认
// .setApkMD5("3df5b1c1d2bbd01b4a7ddb3f2722ccca")//支持MD5校验,如果缓存APK的MD5与此MD5相同,则直接取本地缓存安装,推荐使用MD5校验的方式 // .setApkMD5("3df5b1c1d2bbd01b4a7ddb3f2722ccca")//支持MD5校验,如果缓存APK的MD5与此MD5相同,则直接取本地缓存安装,推荐使用MD5校验的方式
@ -249,7 +249,7 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
mAppUpdater = new AppUpdater.Builder() mAppUpdater = new AppUpdater.Builder()
.serUrl(mUrl) .setUrl(mUrl)
.setVibrate(true) .setVibrate(true)
.setSound(true) .setSound(true)
.build(getContext()); .build(getContext());

Loading…
Cancel
Save