I've been having some odd problems with permission in Android. I am trying to just get a list of the google calendars a particular user has, but first I need to let them pick the account.
I included this line in my manifest:
<uses-permission android:name="android.permission.GET_ACCOUNTS"></uses-permission>
However I get this error:
12-26 03:26:31.004 13841 13841 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{....}: java.lang.SecurityException: caller uid 10105 lacks any of android.permission.GET_ACCOUNTS
I had tried something similar with gaining access to the undocumented Calendar API with READ_CALENDAR
and WRITE_CALENDAR
, but I had similar exceptions (although probably for different reasons - I thought it might be worth mentioning in case it wasn't).
Please clue me in on what I'm doing wrong!
Thanks!
Either your <uses-permission>
is in the wrong place (should be a child of <manifest>
and a peer of <application>
), or GET_ACCOUNTS
is not a permission that SDK applications can hold. The documentation is singularly lousy about indicating which permissions are and are not eligible for SDK applications.
Had the same problem as well, changed the target SDK version in the AndroidManifest.xml to a higher version (19). In my case the target SDK version in the manifest was 17, which is equivalent to Android 4.2.2, which in turn matched the version on my HTC One. However after changing it, the Phonegap plugin for contacts worked.
来源:https://stackoverflow.com/questions/4533206/permissions-not-working