调用bindAppWidgetId时出现安全异常
在为 Android 开发启动器(主屏幕)应用程序时,我遇到了一个我不明白的安全异常。
- 当拨打电话时 [bindAppWidgetId()][1] 方法来自 在我的启动器活动中,我得到 此安全异常:
08-19 11:30:11.689:错误/AndroidRuntime(6032):java.lang.SecurityException:bindGagetId appWidgetId = 99provider = ComponentInfo {com.android.music/com.android.music.MediaAppWidgetProvider}:< strong>用户 10034 没有 android.permission.BIND_APPWIDGET。
我首先以为我忘记了清单中的 BIND_APPWIDGET 权限,但它确实存在。
android api 文档指出了这一点:
“您需要 APPWIDGET_LIST 允许。这个方法要使用 通过 AppWidget 选择器。”
我尝试添加权限 android.permission.APPWIDGET_LIST,但这并不能解决问题。
设置”应用程序的清单:有一个特殊的行要求共享用户 ID:
“android:sharedUserId =”android.uid.system“
这可能与我的问题有关吗?
如果有人有一个想法那就太好了!
干杯, 洛朗
While developing a Launcher (Homescreen) application for Android, I've come into a security exception I don't understand.
- When calling the
[bindAppWidgetId()][1] method from
within my Launcher Activity, I get
this security exception :
08-19 11:30:11.689: ERROR/AndroidRuntime(6032): java.lang.SecurityException: bindGagetId appWidgetId=99 provider=ComponentInfo{com.android.music/com.android.music.MediaAppWidgetProvider}: User 10034 does not have android.permission.BIND_APPWIDGET.
I first thought I had forgotten the BIND_APPWIDGET permission in my manifest, but it is definitely there.
The android api documentation states this :
"You need the APPWIDGET_LIST
permission. This method is to be used
by the AppWidget picker."
I tried to add the permission android.permission.APPWIDGET_LIST, but it doesn't solve the issue.
Also, I've looked at the manifest of the Settings application from the android sources that contains the AppWidgetPickActivity code : there's a special line that asks to share user id :
"android:sharedUserId="android.uid.system"
Could it be related to my problem ?
If anyone has an idea that would be great !
Cheers,
Laurent
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了答案!
BindAppWidgetId() 故意不可供应用程序使用! (安全问题)。
以下是此信息的链接:
http://groups.google.com/group/android-developers/browse_thread/thread/231245ba6d1e690f/047b9d3f776d7e54?lnk=gst&q=bindAppWidgetId#047b9d3f776d7e54
< a href="http://groups.google.com/group/android-developers/browse_thread/thread/f24e0f484a79d529/ef84188e8533a125?lnk=gst&q=bindAppWidgetId#ef84188e8533a125" rel="noreferrer">http://groups. google.com/group/android-developers/browse_thread/thread/f24e0f484a79d529/ef84188e8533a125?lnk=gst&q=bindAppWidgetId#ef84188e8533a125
I've found an answer!
BindAppWidgetId() is deliberately not available to applications! (security problems).
Here are the links to this information :
http://groups.google.com/group/android-developers/browse_thread/thread/231245ba6d1e690f/047b9d3f776d7e54?lnk=gst&q=bindAppWidgetId#047b9d3f776d7e54
http://groups.google.com/group/android-developers/browse_thread/thread/f24e0f484a79d529/ef84188e8533a125?lnk=gst&q=bindAppWidgetId#ef84188e8533a125
快速 Google 搜索显示
android.permission.APPWIDGET_LIST
是一个可用的权限,即使它没有在 API 文档中列出。A quick Google search reveals that
android.permission.APPWIDGET_LIST
is a usable permission, even though it's not listed in the API docs.