title: AlarmManager doesn`t start BroadcastReceiver
body: <p>I am trying to use BroadcastReceiver and AlarmManager to set a one-shot alarm. I have no idea why isn`t it working. What am I doing wrong? I have no exceptions, no logs about, no suggestions from IDE, everything seems fine, but onReceive method in my BroadcastReceiver is never called.</p>
  
  <pre><code>    public void setAlarm(Context mContext) {
      AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
  
      Intent intent = new Intent(mContext, AlarmReceiver.class);
      PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 505151550 ,intent, PendingIntent.FLAG_UPDATE_CURRENT);
  
      Calendar cal = Calendar.getInstance();
      cal.add(Calendar.SECOND, 20);
  
      alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);
      Log.d("alarm",cal.getTime().toString());
  }
  </code></pre>
  
  <p>I am calling it from the activity: </p>
  
  <pre><code>new MyManager().setAlarm(this);
  </code></pre>
  
  <p>but I have also tried: <code>new MyManager().setAlarm(MyActivity.this);</code></p>
  
  <pre><code>public class AlarmReceiver extends BroadcastReceiver {
  @Override
  public void onReceive(Context context, Intent intent) {
      Log.d("alarm","got into alarm receiver");
  }}
  </code></pre>
  
  <p>in AndroidManifest.xml :</p>
  
  <pre><code>&lt;receiver android:name="com.example.AlarmReceiver"&gt;&lt;/receiver&gt;
  </code></pre>
  
  <p>but I have also tried </p>
  
  <pre><code>&lt;receiver android:name=".AlarmReceiver"&gt;&lt;/receiver&gt;
  </code></pre>