diff --git a/mylibrary/build.gradle b/mylibrary/build.gradle index 9e746e3..cbf81f9 100644 --- a/mylibrary/build.gradle +++ b/mylibrary/build.gradle @@ -35,6 +35,6 @@ dependencies { testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' - + implementation 'com.github.zyzzchehe:MyCommonUtils:2.2' implementation 'com.github.greenrobot.EventBus:eventbus:V3.2.0' } \ No newline at end of file diff --git a/mylibrary/src/main/java/com/zc/mylibrary/DownloadApkTask.java b/mylibrary/src/main/java/com/zc/mylibrary/DownloadApkTask.java index a2d0772..0a4faeb 100644 --- a/mylibrary/src/main/java/com/zc/mylibrary/DownloadApkTask.java +++ b/mylibrary/src/main/java/com/zc/mylibrary/DownloadApkTask.java @@ -14,6 +14,8 @@ import androidx.annotation.NonNull; import androidx.core.content.FileProvider; +import com.zc.commonutilslib.MLog; + import org.greenrobot.eventbus.EventBus; import java.io.File; @@ -164,7 +166,7 @@ protected void onProgressUpdate(Float... values) { @Override protected void onPostExecute(String s) { super.onPostExecute(s); - Log.i(TAG, "onPostExecute: apk save path = " + s); + MLog.i(TAG, "onPostExecute: apk save path = " + s); DownloadProgressDialogUtils.closeProgressDialog(); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); @@ -184,8 +186,9 @@ protected void onPostExecute(String s) { } } } else { + MLog.i(TAG, "onPostExecute: start install apk"); intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } if (context.getPackageManager().queryIntentActivities(intent, 0).size() > 0) { context.startActivity(intent);