无法从Google Glass发送邮件

时间:2014-07-11 09:34:28

标签: android email android-intent google-glass

我正在尝试从我正在开发的Google Glass应用发送电子邮件。但是,似乎我的应用程序找不到任何应用程序(包括Gmail)来执行此操作。通常情况下,Android手机会显示多种选择,用于共享任何类型的内容(短信,邮件,蓝牙),但不会出现在Google Glass中。有没有人面临同样的问题?

我尝试了不同的代码:

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT   , "body of email");
startActivity(Intent.createChooser(i, "Send mail..."));

这个抛出对话框说没有应用程序可以执行此操作。以下是:

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT   , "body of email");
startActivity(i);

Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setType("message/rfc822");
intent.putExtra(Intent.EXTRA_EMAIL, "recipient@example.com");
intent.setData(Uri.parse("mailto:" + "recipient@example.com"));
intent.putExtra(Intent.EXTRA_SUBJECT, "xxxxxxxxxxxx");
intent.putExtra(Intent.EXTRA_TEXT, "xxxxxxxxxxxxxxxxx");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

说没有找到处理意图的活动。我可以使用Google Glass时间轴中的Gmail帐户发送/接收邮件,但看起来我的应用无法识别它或反之亦然。任何线索?

我已经看到它可以通过使用JavaMail API实现我自己的邮件服务来完成,但我不希望用户输入密码,也不希望代码包含它们。

提前致谢。

3 个答案:

答案 0 :(得分:3)

如果没有关于Glass的电子邮件意图,您将不得不以更原始的方式执行此操作,此答案中有相关说明,包括带有附加图像的电子邮件,请注意有关Internet权限的部分:

看看这个: - Sending Email in Android using JavaMail API without using the default/built-in app

答案 1 :(得分:2)

您无法从Google Glass发送电子邮件

“电子邮件

此时您无法发送电子邮件,但您只能回复一封电子邮件。如果您点击时间线上的电子邮件,则可以选择阅读,回复,存档,加注星标或删除电子邮件。您以与发送消息相同的方式回复电子邮件,即大声说出您的回复。“

但是除了电子邮件之外还有其他通信方式:

http://www.glassappsource.com/google-glass-features/google-glass-email-messaging.html

答案 2 :(得分:0)

将消息内容从平板电脑发送到您的应用,然后执行您尝试使用的Intent,但是可以通过手机执行此操作。

不幸的是,没有简单的方法可以通过玻璃与您的手机通话,但有一些例子可以说明如何做到这一点,其中一个可以在其他SO问题上找到记录。

Google Glass GDK: How to Communicate with Android Device

发送

  

Intent.EXTRA_EMAIL,“recipient@example.com”   Uri.parse(“mailto:”+“recipient@example.com”)   Intent.EXTRA_SUBJECT,“xxxxxxxxxxxx”   Intent.EXTRA_TEXT,“xxxxxxxxxxxxxxxxx”

到手机上,然后按照正常情况继续。

注意,这也需要一个手机应用程序。如果您不想要请求用户帐户信息(包括密码),则无法独立完成此操作。

相关问题