【问题标题】:Cant send mail from Google Glass无法从 Google Glass 发送邮件
【发布时间】:2014-07-11 09:34:28
【问题描述】:

我正在尝试通过我正在开发的 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 实现我自己的邮件服务来完成,但我不希望用户输入密码,也不希望包含密码的代码。

提前致谢。

【问题讨论】:

    标签: android email android-intent google-glass


    【解决方案1】:

    如果没有关于 Glass 的电子邮件意图,您将不得不以更原始的方式进行操作,此答案中有这样做的说明,包括带有附加图像的电子邮件,请注意有关互联网许可的部分:

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

    【讨论】:

    • 正如我刚刚编辑的那样,我无法向用户询问密码或将其保存在代码中。无论如何,感谢您的快速响应。
    【解决方案2】:

    您无法通过 Google Glass 发送电子邮件

    “电子邮件

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

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

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

    【讨论】:

    • 我得到了赏金吗?那是我第一次 :D
    【解决方案3】:

    将消息内容从玻璃发送到您的应用程序,然后执行您尝试使用的Intent,但从手机执行。

    不幸的是,没有简单的方法可以通过玻璃与您的手机通话,但有一些示例说明如何操作,您可以在另一个 SO question 中找到其中一个示例。

    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"

    接电话,然后像往常一样继续。

    请注意,这也需要手机应用程序。如果您不想请求用户的帐户信息(包括密码),则无法通过 Glass 独立执行此操作。

    【讨论】:

      猜你喜欢
      • 2015-04-25
      • 1970-01-01
      • 1970-01-01
      • 2016-02-03
      • 2016-05-30
      • 2014-04-06
      • 1970-01-01
      • 2021-06-06
      • 1970-01-01
      相关资源
      最近更新 更多