权限不工作权限、工作

2023-09-05 01:46:38 作者:? 正在缓冲99%

我一直有一些奇怪的问题,在Android的许可。我想只得到一个列表的谷歌日历的特定用户,但首先我需要让他们挑的帐户。

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.

我列入此行我的清单:

<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

我曾试图与获得访问无证日历API与 READ_CALENDAR WRITE_CALENDAR 类似的东西,但我有类似的例外(虽然可能出于不同的原因 - 我想这可能是值得一提的情况下,它是不是)

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!

谢谢!

推荐答案

无论你的&LT;使用-许可&GT; 是在错误的地方(应该是一个孩子&LT;舱单&GT; ℃的对等;用途&gt; )或 GET_ACCOUNTS 不是一个权限,该SDK应用程序可以持有。该文档是奇烂有关指示哪些权限,而且没有资格SDK应用程序。

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.