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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With