本文介绍了显示全屏"访问请求"使用getAuthToken当对话框,而不是通知(...)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了一个AccountAuthenticator的,我想在其他应用程序不同的签名使用的web服务。我想立即显示全屏访问请求对话框(这个: http://i.imgur.com /gcndGZs.png代替通知)使我确信我有我的设置为SyncAdapter自动同步前访问该帐户。

I built an AccountAuthenticator for a webservice that I'd like to use in other applications with different signatures. I'd like to instantly show the fullscreen access request dialog (this one: http://i.imgur.com/gcndGZs.png) instead of a notification so that I'm certain I have access to the account before setting my SyncAdapter to sync automatically.

到目前为止,我已经试过了getAuthToken,其中一个显示的通知:

So far I've tried the getAuthToken, one of which shows a notification:

manager.getAuthToken(帐户,全,空,真正的回调,新的处理程序());

另外抛出一个异常:

manager.getAuthToken(帐户,全,空,活动,回调,新的处理程序());

java.lang.SecurityException: Activity to be started with KEY_INTENT must share Authenticator's signatures
        at com.android.server.accounts.AccountManagerService$Session.onResult(AccountManagerService.java:2206)
        at com.android.server.accounts.AccountManagerService$6.onResult(AccountManagerService.java:1411)
        at com.android.server.accounts.AccountManagerService$6.onResult(AccountManagerService.java:1386)
        at android.accounts.IAccountAuthenticatorResponse$Stub.onTransact(IAccountAuthenticatorResponse.java:59)
        at android.os.Binder.execTransact(Binder.java:404)
        at dalvik.system.NativeStart.run(Native Method)`

是否有可能显示访问请求对话框而不从应用程序的通知这是一个不同的密钥签名?

Is it possible to show the access request dialog without a notification from an app that was signed with a different key?

推荐答案

这似乎是一个错误(或安全功能)的奇巧,preventing交叉应用程序标记共享。我建议你​​使用自己定制的意图和安全性验证,而不是依赖于Android的API的实现令牌共享。

This appears to be a bug (or security feature) in KitKat, preventing cross app token sharing. I recommend you implement token sharing using your own custom intents and security validation, rather than relying on Android's APIs.

这篇关于显示全屏"访问请求"使用getAuthToken当对话框,而不是通知(...)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 23:13