我正在按照找到的说明进行操作 here at android developer .这些说明说要将这两行代码添加到 list 中:
<manifest ... >
<uses-permission android:name="android.permission.ACCOUNT_MANAGER" />
<uses-permission android:name="android.permission.INTERNET" />
...
</manifest>
问题是我现在在“ACCOUNT_MANAGER”行上收到一条错误消息,提示“权限仅授予系统应用程序”。
我的应用程序不是系统应用程序,我需要对 OAuth2 服务进行身份验证。任何使用 OAuth2 的应用程序怎么可能需要成为系统应用程序?
有谁知道如何在不要求我的应用程序成为“系统应用程序”的情况下使用 ACCOUNT_MANAGER?
我看过this question和 this question .他们说,对于他们列出的权限,错误是“假”错误消息。有谁知道“ACCOUNT_MANAGER 错误”是否是假消息?我可以像其他帖子中的建议一样告诉编译器忽略它吗?
最佳答案
String ACCOUNT_MANAGER
Allows applications to call into AccountAuthenticators.
Not for use by third-party applications.
ACCOUNT_MANAGER权限只能授予系统应用
如果您的应用需要 AccountManager,您可以像这样创建一个 AccountAuthenticator 服务 tutorial
或者您可以请求 MANAGE_ACCOUNTS 权限,如 this answer 中所述
MANAGE_ACCOUNTS: The API documentation is not that clear about this permission. But according to Bryans answer, an app can only delete/modify an account it created itself. Of course it can create any new account, and manage that.
关于android - 账户管理器 - "Permission is only granted to system apps",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46823835/