调用bindAppWidgetId时出现安全异常

发布于 2024-09-15 01:06:16 字数 793 浏览 2 评论 0原文

在为 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 技术交流群。

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

发布评论

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

评论(2

你的笑 2024-09-22 01:06:18

我找到了答案!

BindAppWidgetId() 故意不可供应用程序使用! (安全问题)。

“android.permission.BIND_APPWIDGET
权限是系统权限。
只有在您的情况下才能获得该许可
软件包作为系统安装
(安装在/system/app中
而不是 /data/app)或为您的应用程序签名
拥有与以下相同的证书
你的安卓图像。所以基本上这个
表示您只能使用此权限
如果您也是该项目的创造者
您的平台/手机上的 Android 映像。”

以下是此信息的链接:

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).

"The android.permission.BIND_APPWIDGET
permission is a system permission. You
can only get that permission if your
package is installed as a system
package
(installed in /system/app in
stead of /data/app) or sign you app
with a certificate that's the same as
your android image. So basicly this
means you can only use this permission
if you are also the creator of the
android image on your platform/phone."

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

花开半夏魅人心 2024-09-22 01:06:18

快速 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.

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