Android - send audio file using MMS

Im using the following code to send audio files via email, dropbox +++ .. This prevents me from sending the same file via MMS. Does anyone know how to connect it to an MMS message and let the user send if he 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"));
+3
source share
1 answer

you can use 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 should use your appropriate type of set .if audio then audio / * , then image / image

This code works with my samsung nexus, ace 5830, but htc amaze does not work. If anyone found any solution, then please give a snippet.

0
source

Source: https://habr.com/ru/post/1796674/


All Articles