80,488
社区成员
发帖
与我相关
我的任务
分享Uri packageUri = Uri.fromFile(file);
public void getDownloadFile() {
if (DEBUG)
NLog.i(Tag, "xuezhg CM_POSTREQUEST_REGISTER begin......");
String sendURL = ReaderPreferences.getUpdateUrl();
if (sendURL == null) {
Log.e(Tag, "send URL is null!");
processsDialog.dismiss();
// ophone start modfy by wangjd 2010.06.03 for Neu0000878
// Toast.makeText(this, "升级失败,请稍后重试...", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.update_failed, Toast.LENGTH_SHORT)
.show();
// end for Neu0000878
mHandler.sendEmptyMessageDelayed(0, 1000);
return;
}
Log.e(Tag, "URL : " + sendURL);
URL url = null;
try {
url = new URL(sendURL);
} catch (Exception e) {
Log.e(Tag, sendURL + " is not a URL");
}
String proxy = "10.0.0.172";
String port = "80";
Log.e(Tag, "Auth : " + proxy + ":" + port);
Properties systemProperties = System.getProperties();
systemProperties.setProperty("http.proxyHost", proxy);
systemProperties.setProperty("http.proxyPort", port);
HttpURLConnection conn = null;
try {
conn = (HttpURLConnection) url.openConnection();
Log.e(Tag, "response code : " + conn.getResponseCode());
Log.e(Tag, "URL is : " + conn.getURL().toString());
sendURL = conn.getURL().toString();
} catch (Exception e) {
Log.e(Tag, "get connecntion error");
}
try {
Log.e(Tag, ((HttpURLConnection) url.openConnection()).getURL()
.toString());
} catch (Exception e) {
Log.e(Tag, "openURL error: " + e.toString());
}
// filename = CM_Utility.getImagePath() +
// CM_Utility.getImageName(sendURL);
filename = CM_Utility.getBookPath() + CM_Utility.getImageName(sendURL);
CM_Utility.sendCommand(CM_CommandDef.CM_DOWNLOAD_START, sendURL,
CM_ActivityList.LOADING);
// CM_Utility.Update(CM_MessageDef.CM_GET_DOWNLOAD, sendURL, 0, 0,
// CM_ActivityList.LOADING);
if (DEBUG)
NLog.i(Tag, "xuezhg sendURL: " + sendURL);
if (DEBUG)
NLog.i(Tag, "xuezhg filename: " + filename);
}