权限不起作用 [英] Permissions Not Working

查看:36
本文介绍了权限不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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.

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

I included this line in my manifest:

<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 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!

谢谢!

推荐答案

要么是你的 放错地方了(应该是 的子级) 的同级),或者 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.

这篇关于权限不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆