开发者

Android - Sending audio-file with MMS

开发者 https://www.devze.com 2023-02-15 07: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..

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消