3

我使用以下代码通过电子邮件、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"));
4

1 回答 1

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

您必须使用适当的设置类型 .if audio 然后audio/* ,image 然后image/png

此代码适用于我的 samsung nexus、ace 5830 但不适用于 htc amaze。如果有人找到任何解决方案,请提供代码段。

于 2013-01-10T10:11:40.150 回答