從我的AppWidgetProvider類中的onReceive或onUpdate啓動服務時,我總是收到此錯誤。Android PermissionDenial:Bind_RemoteViews權限
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
我已經在Android Manifest中聲明瞭權限。
但它仍然給我這個。
有什麼我做錯了嗎?
這裏是我的代碼看起來像..
@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);
}
}
編輯:我有它在我的清單中聲明..
這裏是我仍然得到...
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
編輯:清單
<uses-permission android:name="android.permission.BIND_REMOTEVIEWS"></uses-permission>
<service android:name="StackWidgetService"
android:enabled="true"
/>
有許可和服務中聲明我manfiest
你在用你的代碼試圖做什麼...你是否正在嘗試在其他應用程序中使用它或類似的東西...? –
No ..im僅在一箇中使用它。 –