title: Why onReceive is not called extending BroadcastReceiver in Android
body: <p>the onReceive method isn't called for some reason<br>
  I've not applied any filters or anything,</p>
  
  <p>Here is the class :  </p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Calendar;
  
  import android.content.BroadcastReceiver;
  import android.content.Intent;
  import android.content.Context;
  import android.util.Log;
  
  public class RegisterListener extends BroadcastReceiver {
  private final int DELAY_TIME = 5;
  private int m_seconds = 0;
  private int m_minutes = 0;
  private int m_hours   = 0;
  static ArrayList&lt;BroadcastReceiverListener&gt; listeners = new ArrayList&lt;BroadcastReceiverListener&gt;();
  
  @Override
  public void onReceive(Context context, Intent intent) {
  
      Log.d("ScreenReceiver Action:",intent.getAction());
  
      Calendar c = Calendar.getInstance(); 
      m_seconds = c.get(Calendar.SECOND);
      m_minutes = c.get(Calendar.MINUTE);
      m_hours = c.get(Calendar.HOUR);
  
      for (BroadcastReceiverListener listener:listeners){
             listener.onReceive(m_hours, m_minutes, m_seconds);
          }
  }
  
  
  public static void addBroadcastReceiveListener (BroadcastReceiverListener listener){
      if(!listeners.contains(listener)){
          listeners.add(listener);
      }
  }
  
  public void removeBroadcastReceiveListener (BroadcastReceiverListener listener){
      if(listeners.contains(listener)){
          listeners.remove(listener);
      }
  }
  </code></pre>
  
  <p>Here is the declaration in the manifest (child of Application)</p>
  
  <pre><code>&lt;receiver android:name=".RegisterListener"&gt;&lt;/receiver&gt;
  </code></pre>
  
  <p><em><strong>Edit :</em></strong> 
  This is the filter i tried to add (inside the onReceive() )</p>
  
  <pre><code>    IntentFilter filter = new IntentFilter(Intent.ACTION_USER_PRESENT);
      BroadcastReceiver mReceiver = new RegisterListener();
      registerReceiver(mReceiver, filter);
  </code></pre>
  
  <p>I get an error :</p>
  
  <pre><code>The method registerReceiver(BroadcastReceiver, IntentFilter) is undefined for the type RegisterListener
  </code></pre>