Android - 使用彩信发送音频文件

时间:2011-03-06 20:02:42

标签: android audio android-intent mms

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

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

1 个答案:

答案 0 :(得分:0)

您可以使用此代码..

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

此代码使用我的三星nexus,ace 5830但没有工作htc amaze。如果有人找到任何解决方案,那么请给代码片段。