8

I am following the instructions found here at android developer. These instructions say to add these two lines of code into the manifest:

<manifest ... >
    <uses-permission android:name="android.permission.ACCOUNT_MANAGER" />
    <uses-permission android:name="android.permission.INTERNET" />
    ...
</manifest>

The problem is that I now get an error on the "ACCOUNT_MANAGER" line saying "Permission is only granted to system apps".

My application is not going to be a system application and I need to authenticate to OAuth2 services. How can it be possible that ANY app that uses OAuth2 needs to be a system application?

Does anyone know how to use ACCOUNT_MANAGER without requiring my application to be a "system application"?

I've looked at this question and this question. They say that, for the permissions they have listed, the error is a "fake" error message. Does anyone know if the 'ACCOUNT_MANAGER error is a fake message? Can I tell the compiler to ignore this like the suggestions in these other posts?

user1567453
  • 1,837
  • 2
  • 19
  • 22
  • In new version of android use ContextCompat.checkSelfPermission . Try it – Nikola Lukic Oct 19 '17 at 06:36
  • Can you tell us for what you need OAuth2? Mostly, you can use something like Google Sign In API if you need it for authenticating users from their existing account – sziraqui Oct 19 '17 at 06:41

1 Answers1

2

From documentation

String ACCOUNT_MANAGER

Allows applications to call into AccountAuthenticators.

Not for use by third-party applications.

ACCOUNT_MANAGER permission can only be granted to system app

If your app requires AccountManager, you can create an AccountAuthenticator service like in this tutorial

Or you can request MANAGE_ACCOUNTS permission as explained in 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.

sziraqui
  • 5,763
  • 3
  • 28
  • 37