Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android PermissionDenial: Bind_RemoteViews Permission

Tags:

android

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

like image 399
coder_For_Life22 Avatar asked Sep 15 '11 15:09

coder_For_Life22


People also ask

How do I set permissions in Android programmatically?

You need to declare the permissions in the manifest file first before you request for them programmatically. refer this for more information. declaring the permission in the manifest file is static type declaration by which your os know what kind of permission your app might require.


1 Answers

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.

like image 107
André Godoy Avatar answered Oct 23 '22 07:10

André Godoy