Permissions Not Working
Asked Answered
I

2

12

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!

Intermolecular answered 26/12, 2010 at 8:32 Comment(0)
R
20

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.

Restful answered 26/12, 2010 at 10:10 Comment(2)
Thanks! Stupid me, I had the uses permission tag as a child of the application tag.Intermolecular
your question helped me solve my own question thanks for the genius post and making me feel so dumb that it was so easy to solve :)Beecham
C
2

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.

Conner answered 7/12, 2013 at 22:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.