Skip to content

Commit

Permalink
安装APK代码测试
Browse files Browse the repository at this point in the history
  • Loading branch information
maning committed Apr 1, 2017
1 parent 9259a1e commit 2bdabbb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,15 @@ public void onStart() {
@Override
public void onComplete(String path) {
KLog.i("onComplete:" + path);
InstallUtils.installAPK(context, path);
if (dialogCloseWarn != null) {
dialogCloseWarn.dismiss();
}
if (dialogUpdate.isCancelled()) {
return;
}
dialogUpdate.dismiss();
//安装APK
InstallUtils.installAPK(context, path);
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/maning/gankmm/utils/InstallUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ public static void installAPK(Context context, String filePath) {
intent.setDataAndType(Uri.parse("file://" + filePath), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
//关闭旧版本的应用程序的进程
android.os.Process.killProcess(android.os.Process.myPid());
}

}
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ ext {
buildToolsVersion = "25.0.2"
minSdkVersion = 16
targetSdkVersion = 25
versionCode = 16
versionName = "1.5.1"
versionCode = 15
versionName = "1.5.0"
storePassword = "123456"
keyAlias = "Gank"
keyPassword = "123456"
Expand Down

0 comments on commit 2bdabbb

Please sign in to comment.