title: Alarm Manager does not work in background on Android 6.0
body: <p>This is my <code>Activity</code> code,</p>
  
  <pre><code>Long time = new GregorianCalendar().getTimeInMillis()+20000;//Setting alarm after 20 sec
  Intent intentAlarm = new Intent("alarm");
  intentAlarm.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  intentAlarm.putExtra("req_code",10);
  PendingIntent pendingIntent = PendingIntent.getBroadcast(context,10, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
  AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
  alarmManager.set(AlarmManager.RTC_WAKEUP, time, pendingIntent);
  </code></pre>
  
  <p>These are all the permissions that I have in my app,</p>
  
  <pre><code>  &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
      &lt;uses-permission android:name="android.permission.GET_ACCOUNTS"/&gt;
      &lt;uses-permission android:name="com.myapp.pack.permission.SET_ALARM"/&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  </code></pre>
  
  <p>This is my <code>BroadcastReceiver</code> code,</p>
  
  <pre><code>@Override
  public void onReceive(Context context, Intent intent) {
          SharedPreferences sharedPreferences =
          context.getSharedPreferences( "mydata", Context.MODE_PRIVATE);
          SharedPreferences.Editor editor = sharedPreferences.edit();
          editor.putBoolean("elligible",true);
          editor.apply();
  
      }
  </code></pre>
  
  <p>I have registered my <code>BroadcastReceiver</code> in the manifest,</p>
  
  <pre><code> &lt;receiver android:name="com.myapp.pack.AlarmReciever" android:enabled="true"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
              &lt;action android:name="alarm" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  </code></pre>
  
  <p>The above code successfully executes the <code>BroadcastReceiver</code> on pre-MarshMallow devices in the background ,but on a MarshMallow device ,the <code>BroadcastReceiver</code> does not get executed. Does anyone know what could be happening here? Thanks.</p>