Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
419 views
in Technique[技术] by (71.8m points)

android - Show fullscreen "Access Request" dialog instead of notification when using getAuthToken(...)

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.

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

manager.getAuthToken(account, "full", null, true, callback, new Handler());

The other throws an exception:

manager.getAuthToken(account, "full", null, activity, callback, new Handler());

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...