我有一个AppWidget,在其中我的OnEnabled()方法中注册了BroadcastReceiver:
public void onEnabled(Context context){
//Create the intent
Intent sendIntent = new Intent(context, LightRowWidget.class);
sendIntent.setAction(ACTION_APPWIDGET_UPDATE);
// Get the ids
AppWidgetManager manager = AppWidgetManager.getInstance(context);
int[] ids = manager.getAppWidgetIds(new ComponentName(context, LightRowWidget.class));
// set the broadcastReceiver
NetworkReceiver mReceiver = new NetworkReceiver(sendIntent, ids);
// Register it
// Register the broadcast for connectivity change, which also receives disabling of a
// widget.(if widget is disabled, broadcast will be unregistered).
IntentFilter intentFilter = new IntentFilter();
// add a filter
intentFilter.addAction(widgetDisabled);
intentFilter.addAction(connectivityChange);
intentFilter.setPriority(Integer.MAX_VALUE);
context.getApplicationContext()
.registerReceiver(mReceiver,intentFilter);
这可能是什么原因?