如何确定我的 Android Google 帐户凭据是否有效?
谷歌帐户更新后,如何确定该帐户的凭据是否有效?仅当用户在手机上输入有效凭据后,我才需要启动 C2DM 通信。我需要在 Android 2.2 中检查这一点
After an google account is updated, how to determine if credentials for that account are valid? I need to start C2DM communication only after the user enter valid credentials on his phone. I need to check this in Android 2.2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要接收 C2DM 消息,您的说法是对的,设备需要用户登录其 Google 帐户,但您的应用不需要访问用户的密码。如果用户最终在设备上注销了其 Google 帐户,那么您就会知道,因为 C2DM 注册将会失败。我认为这是检查这一点的正确方法 - 在您收到成功的注册响应之前,假设设备无法使用 C2DM,然后您可以阻止对应用程序 UI 的访问,或显示一条消息“之前”使用此应用程序时,请确保您已登录您的 Google 帐户”
To receive C2DM messages you are right that the device needs the user to be signed into their Google Account, but your app does not need access to the user's password. If the user ends up signed out of their Google Account on the device, then you will know because the C2DM registration will fail. I think that is the right way to check for this - that until you have received a successful registration response, assume the device is not able to use C2DM, and you could then block access to the app's UI, or show a message saying "Before using this app, please make sure you are signed into your Google account"