权限不起作用

发布于 2024-10-09 08:43:17 字数 628 浏览 9 评论 0原文

我在 Android 中遇到了一些奇怪的权限问题。我试图获取特定用户拥有的谷歌日历列表,但首先我需要让他们选择帐户。

我在清单中包含了这一行:

<uses-permission android:name="android.permission.GET_ACCOUNTS"></uses-permission>

但是我收到此错误:

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

我尝试了类似的方法来使用 READ_CALENDARWRITE_CALENDAR 访问未记录的日历 API,但我有类似的例外(尽管可能出于不同的原因 - 我认为可能值得一提,以防万一)。

请告诉我我做错了什么!

谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凉世弥音 2024-10-16 08:43:17

您的 位于错误的位置(应该是 的子项和 的对等项 code>) 或 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.

梦中楼上月下 2024-10-16 08:43:17

也有同样的问题,将 AndroidManifest.xml 中的目标 SDK 版本更改为更高版本 (19)。在我的例子中,清单中的目标 SDK 版本是 17,相当于 Android 4.2.2,这又与我的 HTC One 上的版本匹配。然而,更改后,联系人的 Phonegap 插件就可以工作了。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文