안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요. 아래에 MMS 보내는 질문 올리고 검색하다 보니. 방법을 찾긴 했는데. 영 제 맘에 안들어서.
다시 질문 올립니다.
MMS application 의 ComposeMessageActivity 의 Filter 를 보면
<activity android:name=".ui.ComposeMessageActivity"
android:configChanges="orientation|keyboardHidden"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android-dir/mms-sms" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="video/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
위와 같습니다.
전 chooser 가 등장하지 않고, 바로 Messaging Application 이 구동되길 원하기 때문에
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
를 사용하고 싶습니다.
Uri mmsUri = Uri.parse("mmsto://");
Intent sendIntent = new Intent(Intent.ACTION_VIEW, mmsUri );
sendIntent.addCategory("android.intent.category.DEFAULT");
sendIntent.addCategory("android.intent.category.BROWSABLE");
sendIntent.putExtra("address", destinationAddress);
sendIntent.putExtra("exit_on_sent", true);
sendIntent.putExtra("subject", subject);
sendIntent.putExtra("sms_body", body);
Uri dataUri = Uri.parse("content://media/external/images/media/1");
sendIntent.putExtra(Intent.EXTRA_STREAM, dataUri);
getContext().startActivity(sendIntent);
그런데, 위의 방법으로 아무리 전달하려 해도, 계속 에러가 발생하네요.
11-18 13:38:39.039: ERROR/AndroidRuntime(25579): Uncaught handler: thread main exiting due to uncaught exception
11-18 13:38:39.069: ERROR/AndroidRuntime(25579): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity}: java.lang.IllegalArgumentException: Type of the attachment may not be EMPTY.
그런데..
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
이 필터를 사용하면 정상적으로 동작이 됩니다.
Intent sendIntent = new Intent(Intent.ACTION_SEND ); // email
sendIntent.addCategory("android.intent.category.DEFAULT");
sendIntent.putExtra("address", destinationAddress);
sendIntent.putExtra("exit_on_sent", true);
sendIntent.putExtra("subject", subject);
sendIntent.putExtra("sms_body", body);
Uri dataUri = Uri.parse("content://media/external/images/media/1");
sendIntent.putExtra(Intent.EXTRA_STREAM, dataUri);
sendIntent.setType("image/png");
getContext().startActivity(sendIntent);
왜 그럴까요.
SDK 1.6 입니다.
회색님 좀 도와주세요.ㅠ.ㅠ
다시 질문 올립니다.
MMS application 의 ComposeMessageActivity 의 Filter 를 보면
<activity android:name=".ui.ComposeMessageActivity"
android:configChanges="orientation|keyboardHidden"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android-dir/mms-sms" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="video/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
위와 같습니다.
전 chooser 가 등장하지 않고, 바로 Messaging Application 이 구동되길 원하기 때문에
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
를 사용하고 싶습니다.
Uri mmsUri = Uri.parse("mmsto://");
Intent sendIntent = new Intent(Intent.ACTION_VIEW, mmsUri );
sendIntent.addCategory("android.intent.category.DEFAULT");
sendIntent.addCategory("android.intent.category.BROWSABLE");
sendIntent.putExtra("address", destinationAddress);
sendIntent.putExtra("exit_on_sent", true);
sendIntent.putExtra("subject", subject);
sendIntent.putExtra("sms_body", body);
Uri dataUri = Uri.parse("content://media/external/images/media/1");
sendIntent.putExtra(Intent.EXTRA_STREAM, dataUri);
getContext().startActivity(sendIntent);
그런데, 위의 방법으로 아무리 전달하려 해도, 계속 에러가 발생하네요.
11-18 13:38:39.039: ERROR/AndroidRuntime(25579): Uncaught handler: thread main exiting due to uncaught exception
11-18 13:38:39.069: ERROR/AndroidRuntime(25579): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity}: java.lang.IllegalArgumentException: Type of the attachment may not be EMPTY.
그런데..
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
이 필터를 사용하면 정상적으로 동작이 됩니다.
Intent sendIntent = new Intent(Intent.ACTION_SEND ); // email
sendIntent.addCategory("android.intent.category.DEFAULT");
sendIntent.putExtra("address", destinationAddress);
sendIntent.putExtra("exit_on_sent", true);
sendIntent.putExtra("subject", subject);
sendIntent.putExtra("sms_body", body);
Uri dataUri = Uri.parse("content://media/external/images/media/1");
sendIntent.putExtra(Intent.EXTRA_STREAM, dataUri);
sendIntent.setType("image/png");
getContext().startActivity(sendIntent);
왜 그럴까요.
SDK 1.6 입니다.
회색님 좀 도와주세요.ㅠ.ㅠ