마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

MMS 이미지 첨부하여 보낼때 내장메모리의 어플리케이션 저장 경로 질문

0 추천
MMS 이미지 첨부하여 보낼때 내장메모리의 어플리케이션 저장 경로의 이미지 Uri를 생성할 수 없나요?

private boolean imageSaved() {
  boolean result = true;
  FileOutputStream fos = null;
  
  try {
   fos = openFileOutput("qrbarcode.jpg", 0);
   bitmap.compress(CompressFormat.JPEG, 100, fos);
  } catch (Exception e) {
   // TODO: handle exception
  result = false;
  Log.v(TAG, "비트맵 저장 실패 : " + e);
  } finally {
   try {
    fos.close();        
   } catch (Exception e) {
    // TODO: handle exception
  result = false;
  Log.v(TAG, "스트림 닫기 실패 : " + e);
   }
  }
  return result;
 }

 

위처럼 어플리케이션의 저장 위치에 이미지를 저장하고

 

 

private void sendMMS() {
     File file = new File("data/data/com.edb.mobileprescription/files/qrbarcode.jpg");
     Uri uri = Uri.fromFile(file);
     Intent intent = new Intent(Intent.ACTION_SEND);
     intent.setType ( "image/*");
     intent.addCategory("android.intent.category.DEFAULT");
     intent.putExtra("exit_on_sent", true);
     intent.putExtra ("address", "01030828659");
     intent.putExtra (Intent.EXTRA_STREAM, uri);
     startActivity(intent);
 }

위처럼 MMS를 보낼때 이미지 위치의 uri를 생성하여 이미지 첨부를 하는데

결과 메시지가 "첨부할 수 없는 파일입니다"라고 토스트가 띄워지네요.

 

SD카드의 download폴더에서 불러올땐 정상적으로 첨부가 되는데 내장메모리에서 불러올때는 첨부가 안되는데

이게 내장메모리때문은 아닌것 같은데 이유를 모르겠습니다.
zitane (120 포인트) 님이 2013년 6월 27일 질문

1개의 답변

0 추천
data/data/com.edb.mobileprescription 에 있는 파일은 다른 앱에서 읽을 수 없으니 당연한 결과입니다.

SD 카드 영역에 이미지를 저장해야 합니다.
익명사용자 님이 2013년 6월 27일 답변
아 그렇군요 .. 감사합니다.
...