[英]Action Intent for Gmail in android?
I am creating an app in which user can share "something" by clicking on a share button. 我正在创建一个应用程序,用户可以在其中单击共享按钮来共享“某物”。 The steps to share "something" are: 共享“某物”的步骤是:
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.. 我设法在http://mobile.tutsplus.com/tutorials/android/android-essentials-using-the-contact-picker/的帮助下获得了联系人的电子邮件ID,但是在选择了联系人之后,我弹出了选择电子邮件客户端,例如“ Gmail”,“ Dropbox”等。
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 );
You cannot send email silently with the default application. 您不能使用默认应用程序静默发送电子邮件。 You can only create an intent that will call an activity and that will fill in all the fields. 您只能创建将调用活动并填充所有字段的意图。
Other possibility is to embed your own email client into yours application. 其他可能性是将您自己的电子邮件客户端嵌入到您的应用程序中。 In this case, if a user provides credentials then you'll have a possibility to send a email silently. 在这种情况下,如果用户提供了凭据,则您可以静默发送电子邮件。 To implement the second options check this: Sending Email in Android using JavaMail API without using the default/built-in app 要实施第二个选项,请检查以下内容: 使用JavaMail API在Android中发送电子邮件,而无需使用默认/内置应用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.