开发者

Android PermissionDenial: Bind_RemoteViews Permission

I keep getting this error when launching a service from onReceive or onUpdate in my AppWidgetProvider class.

09-15 11:54:04.096: WARN/ActivityManager(1318): Permission Denial: Accessing service ComponentInfo{com.fttech.gameIT/com.fttech.StackWidgetService} from pid=1318, uid=1000 requires android.permissi开发者_开发知识库on.BIND_REMOTEVIEWS

Ive already declared the permission in my Android Manifest.

But it still gives me this.

Is there something i am doing wrong?

Here is what my code looks like..

@Override
public void onReceive(Context context, Intent intent){
    AppWidgetManager.getInstance(context);

    intent = new Intent(context, StackWidgetService.class);
    context.startService(intent);

    super.onReceive(context, intent);
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds){

    super.onUpdate(context, appWidgetManager, appWidgetIds);
    Intent intent = new Intent(context, StackWidgetService.class);
    context.startService(intent);
}

}

EDIT: I have it declared in my manifest..

Here is what i still get...

09-15 12:13:03.818: WARN/ActivityManager(1318): Permission Denial: Accessing service ComponentInfo{com.fttech/com.fttech.StackWidgetService} from pid=1318, uid=1000 requires android.permission.BIND_REMOTEVIEWS
09-15 12:13:03.864: WARN/ActivityManager(1318): Permission Denial: Accessing service ComponentInfo{com.fttech/com.fttech.StackWidgetService} from pid=1318, uid=1000 requires  android.permission.BIND_REMOTEVIEWS
09-15 12:13:03.872: WARN/ActivityManager(1318): finishReceiver called but no pending broadcasts
09-15 12:13:03.919: WARN/WidgetAidService(21261): BroadcastReceiver onReceive called
09-15 12:13:03.919: WARN/ActivityManager(1318): Permission Denial: Accessing service ComponentInfo{com.fttech/com.fttech.StackWidgetService} from pid=1318, uid=1000 requires android.permission.BIND_REMOTEVIEWS

EDIT: Manifest

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

    <service android:name="StackWidgetService"
      android:enabled="true"
       />

There is the permission and the Service declared in my manfiest


Try putting your permission inside your service tag:

<application>
    ...
    <service
        android:name=".StackWidgetService"
        android:exported="false"
        android:permission="android.permission.BIND_REMOTEVIEWS" />
</application>

Also, the dot before your class name is important as it is a shortcut (so you don't have to write the fully qualified class name) and the android:enabled attribute is true by default.


I had this problem as well,

Luckily, I had it happen in the project 3 months after first adding the permission.

There must be an error in the SDK as it told me in no uncertain terms "This is a system permission" and wouldn't let me run my project through Eclipse. Via ant however, it built fine. What's more, after cleaning and building the project, it decided that it wasn't a system permission after all and everything was fine.

Hopefully by now your error has disappeared, but it's worth noting for anyone else wandering through here that it's safe to ignore this (AFAIK) if a few clean and rebuilds makes it go away.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜