谷歌帐户身份验证请求允许在运行时 [英] Google Account Authenticator asks for permission at run-time

查看:409
本文介绍了谷歌帐户身份验证请求允许在运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用AccountManager.getAuthToken从我的服务有机会获得Googledocs和S preadsheet API。

I use AccountManager.getAuthToken from my service to have access to Googledocs and Spreadsheet API.

当我从后台做这件事,不想打断用户,我允许用户互动时所需要的AccountManager提高的通知(使用参数布尔notifyAuthFailure)。

As I'm doing it from background and don't want to interrupt user , I allow accountManager to raise notification when user interaction needed (using parameter boolean notifyAuthFailure).

正如我所料,回调函数调用AccounManagerFuture,它解决了与KEY_INTENT场捆绑在这种情况下。

As I expected, CallBack is called with AccounManagerFuture,which resolves to Bundle with KEY_INTENT field in such case.

在这种情况下,您可能需要等待   直到用户响应,这可能   需要数小时或数天或永远。什么时候   用户不会响应并提供一个新的   密码,客户经理会   播放   LOGIN_ACCOUNTS_CHANGED_ACTION意图,   该应用程序可用于尝试   再次

"In that case, you may need to wait until the user responds, which could take hours or days or forever. When the user does respond and supply a new password, the account manager will broadcast the LOGIN_ACCOUNTS_CHANGED_ACTION Intent, which applications can use to try again"

它运作良好,当东西只有大约一个错误的密码。但我运行一个问题,那AccountAuthenticator要求permision在运行时和意图(从通知栏)启动GrantCredentialsPermissionActivity,这之后用户presses按钮(允许或拒绝)不允许我把知道用户已经做出了回应。

It works well, when thing is only about a wrong password. But I run in a problem,that AccountAuthenticator asks for permision at runtime and intent (from notification bar) starts GrantCredentialsPermissionActivity, which after user presses button (Allow or Deny) do not allow me get know that user already responded.

现在的问题是如何获得的时候interection与用户完成知道,然后再试一次获得的authToken。

The question is how to get know when interection with user is finished and try again to get AuthToken.

我cant't得到onActivityResult从GrantCredentialsPermissionActivity,因为我开始从NotificationBar(而不是从我的其他活动,因为我用的服务,同时试图获得令牌)

I cant't get onActivityResult from GrantCredentialsPermissionActivity because I start it from NotificationBar (not from my other activity, as I use service while trying to get token)

我不能指定清单beforehead权限,因为我知道这是一些custome权限,它通过谷歌认证者定义。

I can't specify permissions in manifest beforehead, because as i understand it's some custome permissions, which defined by google authenticator.

这似乎并没有播放任何意图,当用户批准/拒绝的应用程序在运行时请求允许关闭GrantCredentialsPermissionActivity后。 谢谢你。

It doesn't seem to broadcast any intent when user approve/deny requested permission for application at run-time after closing GrantCredentialsPermissionActivity. Thank you.

推荐答案

就在onResume再次检查,将被调用,即使许可活动的对话框。你会被要求超过必要的,但不能过分。

Just check again in onResume that will get called even if the permission activity is a dialog. You will be asking more than needed but not excessively.

这篇关于谷歌帐户身份验证请求允许在运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆