我的Android应用程序使用更新管理器。是否可以在if else语句中添加此方法?如果用户更新了此应用程序,则更新管理器应帮助清除数据和缓存。
//Version Update
if (obj.has("ForceCode")) {
int ForceCode = Integer.parseInt(obj.getString("ForceCode"));
if (ForceCode < 0) {
GoMain();
} else {
if (ForceCode == 0) { //Force Update
url = obj.getString("URL").toString();
if (!url.equals(""))
new com.romobi.fortune.update.UpdateManager(LoginActivity.this, url);
}
if (ForceCode == 1) { //Remind Update
String Version = obj.getString("Version");
url = obj.getString("URL").toString();
dialog = new MyDialog(LoginActivity.this, "Version Update",
"There is New version available(" + Version + ")You Need to be update to log in.", new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
if (!url.equals(""))
new com.romobi.fortune.update.UpdateManager(LoginActivity.this, url);
}
}, new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
//GoMain();
}
});
dialog.show();
}
}
} else {
GoMain();
}