SecurityException:权限拒绝错误
我刚刚升级到新版本的 gmail (v2.3.5),并且我有一个应用程序可以查询内容提供商以获取有关收到消息的联系人的详细信息......
使用最新版本我出现以下错误:
java.lang.SecurityException:权限拒绝:从 ProcessRecord 打开提供程序 com.google.android.gm.provider.MailProvider{40adef58 3576:com.rageconsulting.android.lightflow/10056}(pid=3576,uid=10056)需要 com.google.android.gm.permission.READ_GMAIL 或com.google.android.gm.permission.WRITE_GMAIL`
对于我的清单中的 gmail,我声明以下内容:
<!--permissions for gmail-->
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="com.google.android.providers.gmail.permission.READ_GMAIL"/>
<uses-permission android:name="com.google.android.gm.permission.READ_GMAIL"/>
<uses-permission android:name="com.google.android.gm.permission.WRITE_GMAIL"/>
据我所知,我已经获得了正确的权限。
我的 Gmail 接收器如下所示:
<receiver android:name=".receiver.GmailReceiver">
<intent-filter>
<action android:name="android.intent.action.PROVIDER_CHANGED" android:priority="-10">
</action>
<data android:scheme="content" android:host="gmail-ls" android:pathPattern="/unread/.*">
</data>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PROVIDER_CHANGED" android:priority="-10">
</action>
<data android:mimeType="*/*" android:scheme="content" android:host="gmail-ls" android:path="/unread/^i">
</data>
</intent-filter>
</receiver>
谁能想到我可能错过的事情吗?
I've just upgraded to the new version of gmail (v2.3.5) and I've got an app that queries the content provider to get details about the contacts that messages are received for......
With the latest version I'm getting the below error:
java.lang.SecurityException: Permission Denial: opening provider com.google.android.gm.provider.MailProvider from ProcessRecord{40adef58 3576:com.rageconsulting.android.lightflow/10056} (pid=3576, uid=10056) requires com.google.android.gm.permission.READ_GMAIL or com.google.android.gm.permission.WRITE_GMAIL`
For gmail in my manifest I'm declaring the following:
<!--permissions for gmail-->
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="com.google.android.providers.gmail.permission.READ_GMAIL"/>
<uses-permission android:name="com.google.android.gm.permission.READ_GMAIL"/>
<uses-permission android:name="com.google.android.gm.permission.WRITE_GMAIL"/>
So as far as I can tell I've got the permissions correct.
My gmail receiver looks like the following:
<receiver android:name=".receiver.GmailReceiver">
<intent-filter>
<action android:name="android.intent.action.PROVIDER_CHANGED" android:priority="-10">
</action>
<data android:scheme="content" android:host="gmail-ls" android:pathPattern="/unread/.*">
</data>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PROVIDER_CHANGED" android:priority="-10">
</action>
<data android:mimeType="*/*" android:scheme="content" android:host="gmail-ls" android:path="/unread/^i">
</data>
</intent-filter>
</receiver>
Can anyone think of something that I may have missed out on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
谷歌出于“安全原因”破坏了它。请参阅此支持线程:
http://www.google.com/support/forum/p/gmail/thread?fid=1728955d050a12bd0004a9339272acdb&hl=zh-CN
你需要回到2.3.5之前的版本,即2.3.4.1
Google broke it for 'security reasons'. See this support thread:
http://www.google.com/support/forum/p/gmail/thread?fid=1728955d050a12bd0004a9339272acdb&hl=en
You need to go back to the version before 2.3.5, which was 2.3.4.1