title: ACTION_BATTERY_CHANGED firing like crazy
body: <p>Okay, so I'm working on an AppWidget that checks the battery level and displays it on a TextView. My code looks like this:</p>
  
  <pre><code>public class BattWidget extends AppWidgetProvider {
  
  private RemoteViews views = new RemoteViews("com.nickavv.cleanwidgets", R.layout.battlayout);
  
  @Override
  public void onUpdate(Context context, AppWidgetManager appWidgetManager, int appWidgetIds[]) {
      final int N = appWidgetIds.length;
      context.getApplicationContext().registerReceiver(this,new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
      for (int i = 0; i &lt; N; i++) {
          int appWidgetId = appWidgetIds[i];
          appWidgetManager.updateAppWidget(appWidgetId, views);
      }
  }
  
  @Override
  public void onReceive(Context context, Intent intent) {
      super.onReceive(context, intent);
      Log.d("onReceive", "Received intent " + intent);
      if (intent.getAction().equals(Intent.ACTION_BATTERY_CHANGED)) {
          Integer level = intent.getIntExtra("level", -1);
          views.setTextViewText(R.id.batteryText, level+"%");
          AppWidgetManager myAWM = AppWidgetManager.getInstance(context);
          ComponentName cn = new ComponentName(context, AirWidget.class);
          onUpdate(context, myAWM, myAWM.getAppWidgetIds(cn));
      }
  }
  }
  </code></pre>
  
  <p>And I'm getting concerned because as soon as I drop the widget onto my homescreen it begins firing off about 100 of those Log calls a second, saying it's receiving ACTION_BATTERY_CHANGED. Isn't this only supposed to be broadcast for each percent decrease? It actually caused my entire launcher to lag, I had to uninstall it. That can't be right.</p>