简体   繁体   English

使用Android SDK访问Google帐户(邮件日历)

[英]Google account access (mail calendar) with Android SDK

I'm completely new to Android development and would like to find out if the following is at all possible, and the best way to approach it: 我是Android开发的新手,我想了解一下以下条件是否可行,以及实现该方法的最佳方法:

  • User logs into Google account - NOT stored on the phone (OAuth??) 用户登录Google帐户-未存储在手机上(OAuth ??)
  • App displays their GMail emails - does not need to send, only receive/read 应用程序显示其GMail电子邮件-无需发送,仅接收/阅读
  • App can access their calendar and display events - again read only 应用可以访问其日历并显示事件-再次只读

That's all for the Google side of things! 这就是Google的一面! I've only ever used Facebook auth - so am unsure as to how Google works. 我只使用过Facebook身份验证-因此不确定Google的工作方式。 I can't seem to find any definitive answers on the web. 我似乎在网上找不到任何明确的答案。

Yes, this is all possible. 是的,这一切皆有可能。

You can register a web application that uses OAuth to log onto google. 您可以注册使用OAuth登录到Google的网络应用程序。 https://developers.google.com/accounts/docs/OAuth https://developers.google.com/accounts/docs/OAuth

then you can use GMail API's to use the OAuth token to access user's email https://developers.google.com/google-apps/gmail/oauth_overview 那么您可以使用GMail API使用OAuth令牌访问用户的电子邮件https://developers.google.com/google-apps/gmail/oauth_overview

then for calendar you have the Google Calendar API's also accessed using OAuth. 那么对于日历,您还可以使用OAuth访问Google Calendar API。 https://developers.google.com/google-apps/calendar/ https://developers.google.com/google-apps/calendar/

You can create a web app and use your android app to access your web server database via API's you create. 您可以创建一个Web应用程序,并使用android应用程序通过创建的API访问您的Web服务器数据库。 Using this data you provide a nice GUI for your android users and provide user interactions. 使用这些数据,您可以为Android用户提供一个不错的GUI并提供用户交互。

Another method would be to use only the android client without a web app as mentioned by Jan Gerlinger. 另一种方法是只使用android客户端,而不使用Jan Gerlinger提到的Web应用程序。

You can also check out the source code for k-9 mail app for ideas here: https://github.com/k9mail/k-9 您也可以在此处查看k-9邮件应用程序的源代码以获取建议: https : //github.com/k9mail/k-9

It's a full-featured, open source android email client that supports many protocols including IMAP, SMTP and Microsoft Exchange accounts too. 这是一个功能齐全的开源android电子邮件客户端,也支持许多协议,包括IMAP,SMTP和Microsoft Exchange帐户。 You can dig through the source code to find out how they do it. 您可以深入研究源代码,以了解它们的工作方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM