본문 바로가기

IT Data/#Android

apk 설치소스 중 파일열기가 안되는 현상


public void openMedia(String fileFullPath) {

File file = new File(fileFullPath);

Intent intent = new Intent(Intent.ACTION_VIEW);

intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");

try{

DataWarehouse.mainActCtx.startActivity(intent);

DataWarehouse.mainActivityHandler.obtainMessage( FixValue.ACT_CLOSE_FINISH ).sendToTarget();

}catch(ActivityNotFoundException e){

Toast.makeText( DataWarehouse.mainActCtx, DataWarehouse.mainActCtx.getText(R.string.notapp), Toast.LENGTH_SHORT ).show();

e.printStackTrace();

}

}


해결: intent를 시작한 후에, 앱 종료 명령을 줘야 한다.

앱을 교체하는데, 이전 앱이 죽지 않아 생기는 오류같다.

이전 앱에서 새로운 버전의 같은 앱을 설치해 줄 때는 apk파일을 실행 시킨 후 자신은 종료시켜야 한다.