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?
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.