1

I have already done a voice recording by this code:

recorder = new MediaRecorder();
        recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        recorder.setOutputFile(Environment
                .getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
                +"test.3gp");
        try {
            recorder.prepare();
        } catch (IOException io) {

            Toast.makeText(getApplicationContext(), "Record File", Toast.LENGTH_LONG).show();

        }
        recorder.start();

and trying to share it using a share intent like this:

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);

        sharingIntent.setType("video/3gp");

            sharingIntent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/Downloadtest.3gp");

        startActivity(Intent.createChooser(sharingIntent, "Share via"));

but when my mail is setup it send via email, but i want to share it vaia mms? its being attatched in mms? how to do it?

Akram
  • 7,548
  • 8
  • 45
  • 72
  • @NNirupoma Saha Chaiti accepted answer is work for you.you have to test in htc device.i have htc one can't attached file. – Harshid Jan 11 '13 at 11:43
  • I am doing something similar HERE!!! http://stackoverflow.com/questions/14452808/sending-and-receiving-mms-in-android – Etienne Lawlor Jan 22 '13 at 06:45

2 Answers2

4

You can try this in my case it work perfect.

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);
                Log.e("Path", "" + uri);
                sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
                sendIntent.setType("video/3gp");
                startActivity(sendIntent);

But some device can't accept like Htc Desire,Htc one,lava.In Your case work perfect then paste code.

Harshid
  • 5,701
  • 4
  • 37
  • 50
0

Please try following code,

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
sendIntent.putExtra("sms_body", "some text"); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
sendIntent.setType("audio/3gp"); 
Lucifer
  • 29,392
  • 25
  • 90
  • 143