Android-使用MMS发送音频文件 [英] Android - Sending audio-file with MMS

查看:281
本文介绍了Android-使用MMS发送音频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码通过电子邮件,保管箱+++发送音频文件. 这不是让我选择通过MMS发送相同文件的方法. 任何人都知道如何将其附加到彩信并让用户发送(如果他/她想要的话)?

Im using the following code to send audio-files through email, dropbox +++.. This is not giving me the option to send the same file through MMS.. Anyone know how to attach it to a MMS and let the user send if he/she wants?

        Intent share = new Intent(Intent.ACTION_SEND);
        share.setType("audio/3gpp");
        share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + aFile));
        startActivity(Intent.createChooser(share, "Send file"));

推荐答案

您可以使用此代码.

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
            sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
            sendIntent.putExtra("address", "9999999999");
            sendIntent.putExtra("sms_body", "if you are sending text");   
            final File file1 = new File(Environment.getExternalStorageDirectory().getAbsolutePath(),"Downloadtest.3gp");
            Uri uri = Uri.fromFile(file1);

            sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
            sendIntent.setType("video/3gp");
            startActivity(Intent.createChooser(sendIntent, "Send file"));

您必须使用适当的设置类型.如果是音频,然后是音频/* ,则是图像,然后是 image/png

you have to used your appropriate set type .if audio then audio/*,image then image/png

此代码可以在我的三星ax 5830上正常运行,但不能使htc惊奇.如果有人找到任何解决方案,请给出摘要.

This code work my samsung nexus,ace 5830 but not working htc amaze.If any one found any solution then please give snippet.

这篇关于Android-使用MMS发送音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆