안드로이드 개발 질문/답변
(글 수 45,052)
마켓에 등록되어진 파일을 받는 방법과 apk파일을 다운로드하여 설치하는 방법이 있는데요
제가 하고자 하는것은 어플리케이션이 실행이 되면 업데이트 버튼을 넣고 업데이트 버튼을 누르면 sd카드의 특정폴더로 apk파일을 다운로드 받아서 업데이트 하는 방법을 찾고 있습니다.
다운로드 한다고 하더라도 Astro와 같은 파일메니져 를 이용한 업데이트를 해야하는건가요?
아니면 Astro 파일매니저 없이 업데이트가 가능한가요?
아시는 분 계시면 답변 부탁드릴게요.
감사합니다.
2011.02.15 14:39:37
올레마켓이나 T스토어 등을 보면 그런 다른 프로그램 없이도 잘 설치하죠... 아마 앱 자체에서 앱 설치 관리자에 접근이 가능할겁니다.
설치할 앱 정보는 Intent로 넘겨주던가 하겠죠.
2011.02.15 15:23:35
Intent intent = new Intent(Intent.ACTION_VIEW ,Uri.parse("APK 다운 경로");
startActivity(intent);
다운로드 진행 및 완료를 확인 하실수 있으며
다운로드 완료 후 리스트를 클릭하면 프로그램을 설치 화면이 나타납니다.
startActivity(intent);
다운로드 진행 및 완료를 확인 하실수 있으며
다운로드 완료 후 리스트를 클릭하면 프로그램을 설치 화면이 나타납니다.
2011.02.28 18:16:13
감사합니다~ 해결을 했어요
Boolean value = Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
if(value){
Log.d("SDCARD", "__________ sd card is exist");
} else {
Toast.makeText(getApplicationContext(), "sd카드가 있어야 설치가 됩니다.", 0).show();
}
URL myFileUrl = null;
try {
myFileUrl= new URL(fileUrl);
myFileUrl_Global = new URL(fileUrl);
} catch (MalformedURLException e) {
e.printStackTrace();
}
File apkFile = new File(Environment.getExternalStorageDirectory()+ "/ListViewTest.apk");//HelloAndroid.apk
Log.d("file", apkFile.toString());
Uri apkUri = Uri.fromFile(apkFile);
Log.d("uri", apkUri.toString());
try
{
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType( apkUri, "application/vnd.android.package-archive");
startActivity(intent);
ListViewActivity.this.finish();
}
catch (Exception e)
{
// TODO: handle exception]
Log.d("Exception", e.toString());
}
방식으로 하니 sd카드로 다운받은 파일을 설치할 수 있었습니다.



