title: AlarmManager not working in several devices
body: <p>My app uses AlarmManager and it has been working since 4 years ago. But I noticed it started failing in some devices. </p>
  
  <p>I'm pretty sure code is right (I'm using WakefulBroadcastReceiver, and setExactAndAllowWhileIdle for devices with Doze) because it's working perfectly on Nexus devices, but it fails in devices of some manufacturers (Huawei, Xiaomi...).</p>
  
  <p>Huawei devices, for example, have a kind of battery manager that kill apps, and when an app is killed, scheduled alarms are cancelled. So setting an app as "protected" in Huawei battery manager solves the problem. </p>
  
  <p>But recently I noticed it's not working with more devices: Xiaomi, Samsung (maybe it's related to the new "Smart Manager"?)... It seems that this behavior is becoming a standard: to kill background apps.</p>
  
  <p>Anyone know anything about it? Any way to ensure alarm is fired?</p>
  
  <p>EDIT: This problem is caused by "battery savers" added by different manufacturers. More info here: <a href="https://dontkillmyapp.com/" rel="noreferrer">https://dontkillmyapp.com/</a></p>