我使用以下代码通过电子邮件、Dropbox+++ 发送音频文件.. 这不是给我通过彩信发送相同文件的选项。 任何人都知道如何将它附加到 MMS 并让用户在他/她想要时发送?
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"));
您必须使用合适的设置类型。如果音频然后是 audio/*,图像然后是 image/png
此代码适用于我的三星 nexus、ace 5830 但不适用于 htc amaze。如果有人找到任何解决方案,请提供代码段。
关于Android - 使用彩信发送音频文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5213017/