Skip to content

Commit

Permalink
修改强制更新策略:点击返回键直接返回桌面
Browse files Browse the repository at this point in the history
  • Loading branch information
WVector committed Jul 10, 2017
1 parent db87786 commit c1d7afa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ protected UpdateAppBean parseJson(String json) {
//更新内容
.setUpdate_log(jsonObject.getString("update_log"))
//是否强制更新
.setConstraint(jsonObject.getBoolean("constraint"));
.setConstraint(true);
} catch (JSONException e) {
e.printStackTrace();
}
Expand Down
2 changes: 1 addition & 1 deletion update-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ publish {
userOrg = 'qianwen'//bintray.com用户名
groupId = 'com.qianwen'//jcenter上的路径
artifactId = 'update-app'//项目名称
publishVersion = '3.2.3'//版本号
publishVersion = '3.2.4'//版本号
desc = 'App update tools'
website = 'https://github.com/WVector/AppUpdateDemo'
}
Expand Down
1 change: 0 additions & 1 deletion update-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<activity
android:name=".DialogActivity"
android:configChanges="keyboardHidden|orientation|locale|screenSize"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@style/UpdateAppDialog"
android:windowSoftInputMode="adjustPan|stateHidden">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.vector.update_app;

import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.graphics.Color;
import android.os.Bundle;
Expand Down Expand Up @@ -246,7 +247,10 @@ public void onBackPressed() {
//禁用
if (mUpdateApp != null && mUpdateApp.isConstraint()) {
// ActManager.getInstance().finishAllActivity();
android.os.Process.killProcess(android.os.Process.myPid());
// android.os.Process.killProcess(android.os.Process.myPid());
//返回桌面
startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));
return;
}
super.onBackPressed();
}
Expand Down

0 comments on commit c1d7afa

Please sign in to comment.