private void sendScr(){
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.addCategory("android.intent.category.DEFAULT");
sendIntent.putExtra("address", phoneNumber);
sendIntent.putExtra("exit_on_sent", true);
sendIntent.putExtra("subject", "TEST MMS");
sendIntent.putExtra("sms_body", "MMS 테스트입니다.");
sendIntent.putExtra(Intent.EXTRA_STREAM, MediaStore.Images.Media.insertImage(getContentResolver(), srcimg, fileName, "Map Captured"));
sendIntent.setType("image/png");
myMapView.getContext().startActivity(sendIntent);
}
기존에 저장한 파일을 미디어스토어에 등록하고, 전화번호와 내용, 제목을 가지고 MMS 어플로 넘겨주려고 하는데요.
다른건 모두 Intent에서 넘겨주어 자동입력이 되는데, 이미지 첨부만 안되고, "이미지를 첨부할 수 없습니다."라는
메세지가 뜹니다.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
위 소스를
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/*");
sendIntent.addCategory("android.intent.category.DEFAULT");
sendIntent.putExtra("address", phoneNumber);
sendIntent.putExtra("exit_on_sent", true);
sendIntent.putExtra("subject", "TEST MMS");
sendIntent.putExtra("sms_body", "MMS 테스트입니다.");
Uri dataUri = Uri.parse("file://" + fileName);
sendIntent.putExtra(Intent.EXTRA_STREAM, dataUri);
startActivity(sendIntent);
위와같이 수정하였더니 IOException에러가 발생합니다.
02-18 07:41:58.318: ERROR/Mms/media(15415): IOException caught while opening or reading stream
02-18 07:41:58.318: ERROR/Mms/media(15415): java.io.IOException
02-18 07:41:58.318: ERROR/Mms/media(15415): at org.apache.harmony.luni.platform.OSFileSystem.seek(OSFileSystem.java:114)
02-18 07:41:58.318: ERROR/Mms/media(15415): at org.apache.harmony.nio.internal.FileChannelImpl.size(FileChannelImpl.java:393)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.model.MediaModel.initMediaSize(MediaModel.java:272)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.model.MediaModel.<init>(MediaModel.java:76)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.model.RegionMediaModel.<init>(RegionMediaModel.java:40)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.model.RegionMediaModel.<init>(RegionMediaModel.java:35)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.model.ImageModel.<init>(ImageModel.java:59)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.data.WorkingMessage.changeMedia(WorkingMessage.java:427)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.data.WorkingMessage.setAttachment(WorkingMessage.java:343)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.ui.ComposeMessageActivity.addImage(ComposeMessageActivity.java:2455)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.ui.ComposeMessageActivity.addAttachment(ComposeMessageActivity.java:2541)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.ui.ComposeMessageActivity.handleSendIntent(ComposeMessageActivity.java:2520)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.ui.ComposeMessageActivity.initialize(ComposeMessageActivity.java:1703)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.mms.ui.ComposeMessageActivity.onCreate(ComposeMessageActivity.java:1633)
02-18 07:41:58.318: ERROR/Mms/media(15415): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-18 07:41:58.318: ERROR/Mms/media(15415): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2444)
02-18 07:41:58.318: ERROR/Mms/media(15415): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2497)
02-18 07:41:58.318: ERROR/Mms/media(15415): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
02-18 07:41:58.318: ERROR/Mms/media(15415): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1848)
02-18 07:41:58.318: ERROR/Mms/media(15415): at android.os.Handler.dispatchMessage(Handler.java:99)
02-18 07:41:58.318: ERROR/Mms/media(15415): at android.os.Looper.loop(Looper.java:123)
02-18 07:41:58.318: ERROR/Mms/media(15415): at android.app.ActivityThread.main(ActivityThread.java:4338)
02-18 07:41:58.318: ERROR/Mms/media(15415): at java.lang.reflect.Method.invokeNative(Native Method)
02-18 07:41:58.318: ERROR/Mms/media(15415): at java.lang.reflect.Method.invoke(Method.java:521)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
02-18 07:41:58.318: ERROR/Mms/media(15415): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
02-18 07:41:58.318: ERROR/Mms/media(15415): at dalvik.system.NativeStart.main(Native Method)
어떤 예외인지 알수가 없습니다..
혹시 자동으로 이미지가 첨부되는데에 잘못된 부분이 있다면 답글 부탁드립니다. 감사합니다.