Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permissions Not Working

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!

like image 432
SapphireSun Avatar asked Dec 26 '10 08:12

SapphireSun


People also ask

How do I restore permissions?

You can use the command: takeown /R /F * before launching the ICACLS. But run the command with caution because it may cause system broken. ICACLS command will reset the permissions of all the folders, files and subfolders. Depending on the number of file, the permissions will be fixed in a while.


1 Answers

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.

like image 190
CommonsWare Avatar answered Sep 22 '22 08:09

CommonsWare