0
我試圖使更新檢查在我的應用程序的加載頁面,但我一直在檔案文件中獲取這個可怕的錯誤= DownloadManager.getFileFromServer(info.getUrl() PD);爲什麼我在這個下載管理法在安卓遇到錯誤?
public void run() {
try {
File file = DownloadManager.getFileFromServer(info.getUrl(), pd);
sleep(3000);
installApk(file);
pd.dismiss();
} catch (Exception e) {
Message msg = new Message();
msg.what = DOWN_ERROR;
handler.sendMessage(msg);
e.printStackTrace();
}
}}.start();
}
和在語法分析器信息= UpdataInfoParser.getUpdataInfo(是);
public void run() {
try {
String path = getResources().getString(R.string.serverurl);
URL url = new URL(path);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5000);
InputStream is =conn.getInputStream();
info = UpdataInfoParser.getUpdataInfo(is);
if(info.getVersion().equals(versionname)){
Log.i(TAG,"版本號相同無需升級");
LoginMain();
}else{
Log.i(TAG,"版本號不同 ,提示用戶升級 ");
Message msg = new Message();
msg.what = UPDATA_CLIENT;
handler.sendMessage(msg);
}
} catch (Exception e) {
// 待處理
Message msg = new Message();
msg.what = GET_UNDATAINFO_ERROR;
handler.sendMessage(msg);
e.printStackTrace();
}
}
PS updateInfo時就像下面
public class UpdataInfo {
private String version;
private String url;
private String description;
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
一個獨特的類}
任何人能幫助我嗎?我真的在這裏呆了一週! 你可以給我另一種方式來檢查服務器上的xml文件的更新,謝謝
你會得到什麼錯誤? –
getFileFromServer無法解析 – oratis