Send data to someone

Action: 
android.intent.action.SEND
Action (WebIntents): 
http://webintents.org/share
Input: 
type of the intent is the MIME type of the data being sent. get*Extra can have either a EXTRA_TEXT or EXTRA_STREAM field, containing the data to be sent. If using EXTRA_TEXT, the MIME type should be "text/plain"; otherwise it should be the MIME type of the data in EXTRA_STREAM. Use */* if the MIME type is unknown (this will only allow senders that can handle generic data streams). Optional standard extras, which may be interpreted by some recipients as appropriate, are: EXTRA_EMAIL, EXTRA_CC, EXTRA_BCC, EXTRA_SUBJECT.
Intent Extra: 
Text
Intent Extra: 
Url of a stream
Output: 
None

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

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");

Applications providing Send data to someone

Titlesort icon Provides intent actions Provides intent URIs Uses action Uses URI Description
Gmail

Mail application connected to gmail server

PeerDeviceNet Send data to someone

PeerDeviceNet is both app and middleware to connect android phones and tablets securely thru Wi-Fi network. As an app, it allows a group of devices share web pages, contact information, pictures, videos and other documentations. As middleware, it helps developing connected mobile apps. You can reuse PeerDeviceNet connection manager to connect mobile devices for connected mobile apps or multi-player games. Via PeerDeviceNet apps can send messages to peer devices using intents, messenger or idl interfaces.
Support Android version 2.2 and up.

http://www.peerdevicenet.net

Applications using Send data to someone

Titlesort icon 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.
Features:

  • Browse, open, rename, manage, copy, move, delete or even email files found on your phone. Aware of 100+ registered file extensions.
  • Multiple file selection support.
  • Attach files to email.
  • View thumbnails of image files.
  • Create music playlists with the Send Marked feature.
  • Pack/unpack Zip files.
  • Create Jump Points to any file or folder both in the app and on the Home screen.
OI File Manager File URI

OpenIntents File Manager