在应用之间共享自定义AccountAuthenticator [英] sharing Custom AccountAuthenticator between apps

查看:236
本文介绍了在应用之间共享自定义AccountAuthenticator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个为使用自定义AccountAuthenticator的客户端构建的应用程序.它的运行非常出色,并且可以满足客户的需求.

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.

我应该做些什么,才能使用任何Google Play服务吗?编写一个功能来测试是否存在仅执行身份验证的应用程序,然后将用户带到市场上以安装执行身份验证的应用程序?还是从我们自己的服务器上下载apk?

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?

推荐答案

我正在尝试实现与您相同的环境,使用同一帐户的多个应用程序,我的最终方法是(我没有说这是最好的方法):

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

具有后台"身份验证器应用程序,所有普通应用程序都会检查该应用程序是否已安装,否则启动google play进行下载.

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

此身份验证器应用程序将使用 AccountManager 创建帐户(教程

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)

这篇关于在应用之间共享自定义AccountAuthenticator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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