sharing Custom AccountAuthenticator between apps

此生再无相见时 提交于 2019-12-12 08:14:15

问题


I have an app I've built for a client that uses a custom AccountAuthenticator. It works wonderfully and it does what the client wants.

However, that is only the first app in what will be a collection of apps that will be using the same authentication manager, and this is where I'm not sure how to proceed.

I have no way of knowing which apps will be installed by any given user, or the order they may be installed. I do not what to require the user to provide their credentials for each app; that defeats the purpose of having an authentication manager.

From some initial testing it seems that just including the same code in each app will not work.

Should I do something like what is needed to use any of the google play services? Write a function that tests for the presence of an app that just does authentication stuff, and then send the user off to the market to install the app that does the authentication? Or download the apk from our own servers?

Or is there some other way that would avoid having to push the user out of the app?


回答1:


I'm trying to implement the same environment than you, several applications using same account, my final approach is (I don't say it's the best way):

Have a "background" authenticator application, all normal apps will check if this app is installed, otherwise launch google play to download it.

This authenticator application will create the account using AccountManager (tutorial here) and it will not have any launcher activity, will only be launch from another applications to create the account.

Having this authenticator application, the implementation of the other ones seems easy (seen here)



来源:https://stackoverflow.com/questions/25878114/sharing-custom-accountauthenticator-between-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!