url로 서버로부터 오디오 파일을 다운로드 해, sdcard에 보존 할 수있는 방법.url로 서버로부터 오디오 파일을 어떻게 다운로드 할 수 있습니까
public void uploadPithyFromServer(String imageURL, String fileName) {
try {
URL url = new URL(GlobalConfig.AppUrl + imageURL);
File file = new File(fileName);
Log.d("ImageManager", "download begining");
Log.d("ImageManager", "download url:" + url);
Log.d("ImageManager", "downloaded file name:" + fileName);
/* Open a connection to that URL. */
URLConnection con = url.openConnection();
InputStream is = con.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is, 1024 * 50);
FileOutputStream fos = new FileOutputStream("/sdcard/" + file);
byte[] buffer = new byte[1024 * 50];
int current = 0;
while ((current = bis.read(buffer)) != -1) {
fos.write(buffer, 0, current);
}
fos.flush();
fos.close();
bis.close();
} catch (IOException e) {
Log.d("ImageManager", "Error: " + e);
}
}
위의 코드는 오디오 파일을 다운로드되지 않습니다
나는 아래의 코드를 사용하고 있습니다. menifest 파일에 모든 권한을 사용 경우 PLZ
오디오 파일이 다운로드되지 않는다는 것을 어떻게 알 수 있습니까? – slayton