Priya
Priya

Reputation: 21

MMS in android not working using Intent.ACTION_SEND

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?

Upvotes: 1

Views: 2656

Answers (3)

Suraj Atmanandan
Suraj Atmanandan

Reputation: 1

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())));
                }

Upvotes: 0

Harshid Vasoya
Harshid Vasoya

Reputation: 5721

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);

Upvotes: 1

Rajath
Rajath

Reputation: 11926

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.

Upvotes: 2

Related Questions