我真的不知道出了什么问题,但是我的如果小部件是由系统通过“APPWIDGET_UPDATE”更新的,它会引发以下异常。我尝试了几件事,导出接收器(真/假),我在模拟器和真机上尝试过,但它是一样的。我添加了几个intent-filters
,但它没有工作。
11-06 20:10:10.279: W/ActivityManager(61): Permission denied: checkComponentPermission() reqUid=1000
11-06 20:10:10.279: W/ActivityManager(61): Permission Denial: broadcasting Intent { act=android.appwidget.action.APPWIDGET_UPDATE (has extras) } from com.ency.easychange (pid=1196, uid=10034) requires null due to receiver com.android.settings/com.android.settings.widget.SettingsAppWidgetProvider
我的 AppWidgetProvider 仅被声明,因为我试图消除可能性,但在ExchangeRateWidgetProvider.onReceive()
调用之前抛出异常。
public class ExchangeRateWidgetProvider extends AppWidgetProvider {
public static final String tag = "ExchangeRateWidgetProvider";
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
}
}
我的清单:
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- TODO: Remove, only for traces -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:icon="@drawable/ic_launcher_main"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".EasyChange"
android:label="@string/title_activity_easy_change" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".ExchangeRateWidgetService"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.appwidget.action.APPWIDGET_ENABLED" />
</intent-filter>
</service>
<receiver
android:name=".ExchangeRateWidgetProvider"
android:label="@string/exchange_rate_widget_name"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/exchange_rate_widget_providerinfo" />
</receiver>
<activity
android:name=".WidgetConfigSmall"
android:label="@string/title_activity_widget_config_small"
android:theme="@android:style/Theme.Holo.Dialog"
android:excludeFromRecents="true"
android:exported="true" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
</intent-filter>
</activity>
</application>
如果你能看一下,我很感激......