Deliver some data to someone else.
Who the data is being delivered to is not specified; it is up to the receiver of this action to ask the user where the data should be sent.
This intent is described originally at http://code.google.com/android/reference/android/content/Intent.html#ACT...
|
Title |
Provides intent actions | Provides intent URIs | Uses action | Uses URI | Description |
|---|---|---|---|---|---|
| Blackmoon File Browser |
Blackmoon File Browser is a file manager similar to OI File Manager.
|
||||
| OI File Manager | File URI |
OpenIntents File Manager |
Comments
See the discussion on MIME
See the discussion on MIME types for mail.
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "email text");
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
sendIntent.setType("message/rfc822");
startActivity(Intent.createChooser(sendIntent, "Title:"));
To send a file attachment
To send a file attachment from the SD card use the following code:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("audio/mp3");
sendIntent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
startActivity(Intent.createChooser(sendIntent, "Title:"));
setType should set the MIME type of the file being sent.
A list of commonly used extensions and corresponding MIME types is included in the OI File Manager mimetypes.xml.
PS: In your application, you can easily obtain the file name by calling the PICK FILE intent of the OI File Manager.
File attachment needs to passed as Uri
As mentioned in this Stack Overflow thread, files have to be attached as
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/mysong.mp3"));You need the extra / in file:/// (missing in the Stack Overflow post) as otherwise GMail drops the attachment just before sending stating the file path is wrong.
How to set the address
For the built-in MMS application, the following undocumented extras may be useful:
See current source code:
http://android.git.kernel.org/?p=platform/packages/apps/Mms.git;a=blob;f...
mExternalAddress = intent.getStringExtra("address");mExitOnSent = intent.getBooleanExtra("exit_on_sent", false);
mMsgText = intent.getStringExtra("sms_body");
String subject = intent.getStringExtra("subject");