I am creating an app in which user can share "something" by clicking on a share button. The steps to share "something" are:
- On clicking the share button the contact list should open
- By selecting a contact (with valid a email address) the data should be sent directly to the selected contact from the sender's default email address(Gmail) without popping up a window for selecting an email client like "Gmail", "Dropbox" etc..
I managed to get the email id of contact with the help of http://mobile.tutsplus.com/tutorials/android/android-essentials-using-the-contact-picker/ but after selecting a contact I get a pop up for selecting an email client like "Gmail", "Dropbox" etc..
here is my code so far
if( email.length() != 0 )
{
Intent sharingIntent = new Intent(
android.content.Intent.ACTION_SEND );
sharingIntent.setType("message/rfc822");
String shareBody =
"Hey buddy listen to this station it is awesome\n"
+ mNowPlayingSong.mAudioUrl;
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"I liked this song" );
sharingIntent.putExtra(
android.content.Intent.EXTRA_TEXT, shareBody );
String emailAddressList[] = {email};
sharingIntent.putExtra(Intent.EXTRA_EMAIL, emailAddressList );
startActivity( sharingIntent );