Question

I am developing a Android Application, In which I need to send voice by email. Ans I want that such flow, record a voice and send mail as a audio file in attachment. and I want that voice should not remaining in phone or SD card. is it possible ?

Was it helpful?

Solution

Here is what you need, It works with me.......

Uri uri = Uri.fromFile(new File(YOUR_DIR, YOUR_FILE_NAME)));
    Intent it = new Intent(Intent.ACTION_SEND);   
    it.putExtra(Intent.EXTRA_SUBJECT, "TITLE");   
    it.putExtra(Intent.EXTRA_TEXT, "CONTENT"); 
    it.putExtra(Intent.EXTRA_STREAM, uri);
    it.setType("audio/rfc822");   
    context.startActivity(Intent.createChooser(it,context.getString(R.string.share)));

OTHER TIPS

One of the solution according to me is..

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"); 
startActivityForResult(Intent.createChooser(sendIntent, "Send mail..."),0);

with above code you can send the voice as email attachment and in the onActivityResult() you can delete the file from sdcard/memory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top