开发者

Google Account Authenticator asks for permission at run-time

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

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).

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

"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, 开发者_如何学Python which applications can use to try again"

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.

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

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)

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

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


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.


What I think would be the best way to know when user interaction is finished is to BroadCast an event and receive it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜