Android - Sending audio-file with MMS

我只是一个虾纸丫 提交于 2019-12-10 22:32:46

问题


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

回答1:


you can used this code..

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

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

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



来源:https://stackoverflow.com/questions/5213017/android-sending-audio-file-with-mms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!