问题
How can i send an MMS in android ?
My code using UI as follows :
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("address", "5556");
intent.putExtra("sms_body", "Gudmng !!");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromFile(new File("/sdcard/sky.png"));
intent.putExtra(Intent.EXTRA_STREAM, uri); // imageUri set
intent.setType("image/*")
startActivity(intent);
But still the exception in sending MMS
ERROR/HierarchicalStateMachine(68): TetherMaster - unhandledMessage: msg.what=3
Any Help?
回答1:
I'm not sure what the problem with your code is, but I have used this and it works:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/jpg");
sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
sendIntent.putExtra("sms_body", "hello");
sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivityForResult(sendIntent, 0);
Maybe you can incorporate this and change it according to your needs.
回答2:
If you have to send mms with any image then this code.
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
sendIntent.putExtra("sms_body", "some text");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/image_4.png"));
sendIntent.setType("image/png");
startActivity(sendIntent);
回答3:
Try this :
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Chitza Share");
// shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, data);
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, Activity_Home.sharefileUriList);
// shareIntent.putExtra(Intent.EXTRA_STREAM, (Serializable) sharefileUriList);//pass uri here
final List<ResolveInfo> activities = activity.getPackageManager().queryIntentActivities(shareIntent, 0);
List<DialogItem> appNames = new ArrayList<DialogItem>();
for (ResolveInfo info : activities) {
appNames.add(new DialogItem(info.loadLabel(activity.getPackageManager()).toString(),
info.loadIcon(activity.getPackageManager())));
}
来源:https://stackoverflow.com/questions/5417261/mms-in-android-not-working-using-intent-action-send