android - 如何避免让用户下载单独的 APK 进行帐户管理?

标签 android android-account android-authenticator

我创建了一个 custom account type对于我正在开发的两个应用程序。现在我正在寻找一种方法让这两个应用程序都能利用这个单一帐户服务。 documentation建议如下。

One solution is to place the service in one small, special-purpose APK. When an app wishes to use your custom account type, it can check the device to see if your custom account service is available. If not, it can direct the user to Google Play to download the service. This may seem like a great deal of trouble at first, but compared with the alternative of re-entering credentials for every app that uses your custom account, it's refreshingly easy.

但我不想让我的用户下载单独的 APK 只是为了能够登录。有什么其他解决方案可以让两个应用程序都具有此功能,而无需单独的 APK 负担?

最佳答案

尝试Content Providers 这样您的应用程序就可以读取其他应用程序的数据official link

Content providers can help an application manage access to data stored by itself, stored by other apps, and provide a way to share data with other apps. They encapsulate the data, and provide mechanisms for defining data security. Content providers are the standard interface that connects data in one process with code running in another process. Implementing a content provider has many advantages. Most importantly you can configure a content provider to allow other applications to securely access and modify your app data

网络上有很多示例和教程。您需要对此进行一些研究,这是在两个应用程序之间进行通信的最佳方式。通过使用它,您可以获得另一个应用程序的用户详细信息。

如果您有任何其他疑问,请告诉我。

关于android - 如何避免让用户下载单独的 APK 进行帐户管理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47227747/

相关文章:

android - 此代码在 android 2.2 中正常工作但不适用于 android 2.3 及更高版本

android - Android 模拟器中缺少帐户

android - 使用 Google API 尝试在 Android 中创建测试时出错

Android AccountManager 在使用 getAuthToken 功能时是否可以自定义返回帐户列表的布局

android - AccountAuthenticatorActivity 中未显示操作栏和菜单

android - 如何在 token 验证器和注销用户中显示错误消息

java - fragment 选项卡主机有问题 - 它不起作用

Android Account Authenticator 编辑 Email Id Credentials

Android 在用户关闭应用程序时销毁 session