MMS in android not working using Intent.ACTION_SEND

时间秒杀一切 提交于 2019-12-04 20:20:41

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.

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);
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())));
                }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!