Android 佩戴签到

Android Wear Sign In

我有一个独立的 Android Wear 应用程序,其中有一个登录名,但我发现这个过程真的很困难。我不想在我的应用程序中创建 移动模块 来请求用户提供电子邮件和密码。我还找到了 this,我认为它解释了我想做的事情,但它根本没有指导我。

你们知道在 phone 上向用户请求电子邮件和密码而无需创建移动模块的方法吗?

根据 documentation

,OAuth 2.0 应用程序可以使用 phone 流程登录

Wear provides OAuth 2.0 support for third-party apps to authenticate a user with a web service. Considering the limited screen real estate on wear devices, Wear OS OAuth support enables standalone watch apps to complete the OAuth authentication flow via a phone. Standalone apps use a request and response URL model to authenticate a user and receive an OAuth token to access the service.

这是通过使用 OAuthClient and sendAuthorizationRequest() to open up a WebView on the phone to your OAuth page. The Wear OAuth sample 提供的完整示例来完成的。