如何使用我的代码发送彩信

发布于 2024-10-17 17:18:25 字数 97 浏览 1 评论 0原文

我搜索了几天关于发送彩信的信息,我能找到的只是intent.ACTION_SEND的东西。我正在构建一个消息程序,我真的需要这个彩信发送功能。有什么建议吗?有没有发送彩信的API?

I've searched for couple days about sending MMS,all i can find is the intent.ACTION_SEND things.I'm building a messaging program and i really need this mms sending feature. Any tips about it? Is there any API for sending MMS?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

江湖彼岸 2024-10-24 17:18:25

如果您必须发送带有任何图像的彩信,则使用此代码。

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

如果您必须发送带有音频或视频的彩信文件,则使用此选项。

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
                sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
                sendIntent.putExtra("address", "1213123123");
                sendIntent.putExtra("sms_body", "if you are sending text");   
                final File file1 = new File(mFileName);
                if(file1.exists()){
                    System.out.println("file is exist");
                }
                Uri uri = Uri.fromFile(file1);
                sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
                sendIntent.setType("video/*");
                startActivity(sendIntent);

如有任何疑问,请重播。

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

OR

If you have to send mms with audio or video file then used this.

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
                sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
                sendIntent.putExtra("address", "1213123123");
                sendIntent.putExtra("sms_body", "if you are sending text");   
                final File file1 = new File(mFileName);
                if(file1.exists()){
                    System.out.println("file is exist");
                }
                Uri uri = Uri.fromFile(file1);
                sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
                sendIntent.setType("video/*");
                startActivity(sendIntent);

any query please replay.

等待圉鍢 2024-10-24 17:18:25

为什么 ACTION_SEND 不适合您?您具体需要什么功能?

Intent sendIntent = new Intent(Intent.ACTION_SEND, 
Uri.parse("mms://")); 
sendIntent.setType("image/jpeg"); 
String url = "file://sdcard//tmpPhoto.jpg"; 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url)); 
startActivity(Intent.createChooser(sendIntent, "MMS:"));

简单的例子,但即使如您所见,您也可以使用彩信输入任何类型的数据。如果您想了解更多信息,也可以查看此链接:https://android.googlesource .com/platform/packages/apps/Mms

Why does not ACTION_SEND suit you? What exact functionality do you need?

Intent sendIntent = new Intent(Intent.ACTION_SEND, 
Uri.parse("mms://")); 
sendIntent.setType("image/jpeg"); 
String url = "file://sdcard//tmpPhoto.jpg"; 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url)); 
startActivity(Intent.createChooser(sendIntent, "MMS:"));

Crude example, but even though as you see you may input any type of data there using MMS. You may also check this link, if you want more info: https://android.googlesource.com/platform/packages/apps/Mms

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文