Question: To build an exact and reliable Alarm in Android OS 6, aka Marshmallow, I am forced to use [setAlarmClock](http://developer.android.com/reference/android/app/AlarmManager.html#setAlarmClock(android.app.AlarmManager.AlarmClockInfo,%20android.app.PendingIntent)) method of AlarmManager. The problem is this method displays an alarm icon in top status bar. Since my app needs an alarm to refresh some data at midnight, everyday, it will display alarm icon forever, which is not pleasant.

Answer: 
Unfortunately, this is completely intentional design by the Android developers in order to save battery. This motive becomes clear when you look through the documentation for AlarmManager methods. For example, this quote is taken from the documentation on [`AlarmManager#setExactAndAllowWhileIdle`](https://developer.android.com/reference/android/app/AlarmManager#setExactAndAllowWhileIdle(int,%20long,%20android.app.PendingIntent)):

> 
> These alarms can significantly impact the power use of the device when idle (and thus cause significant battery blame to the app scheduling them), so they should be used with care. **To reduce abuse, there are restrictions on how frequently these alarms will go off** for a particular application. Under normal system operation, it will not dispatch these alarms more than about every minute (at which point every such pending alarm is dispatched); when in low-power idle modes this **duration may be significantly longer, such as 15 minutes**. *[emphasis mine]*
> 
> 
> 

Therefore, Google wants you to signal the user somehow that your app might be draining power by putting the little alarm clock in the status bar if you really really really need to have exact alarms. Quote from the documentation on [`AlarmManager#setAlarmClock`](https://developer.android.com/reference/android/app/AlarmManager#setAlarmClock(android.app.AlarmManager.AlarmClockInfo,%20android.app.PendingIntent)):

> 
> As such, these types of alarms can be extremely expensive on battery use and should only be used for their intended purpose.
> 
> 
> 

Thus, you're left with these two options:

1. Use [`AlarmManager#setExactAndAllowWhileIdle`](https://developer.android.com/reference/android/app/AlarmManager#setExactAndAllowWhileIdle(int,%20long,%20android.app.PendingIntent)) and accept delays up to 15 minutes
2. Use [`AlarmManager#setAlarmClock`](https://developer.android.com/reference/android/app/AlarmManager#setAlarmClock(android.app.AlarmManager.AlarmClockInfo,%20android.app.PendingIntent)) and accept the alarm clock
If I understood you correctly you want to use the `AlarmManager` to schedule a task at midnight without displaying the UI clock. You can use [`AlarmManager#set`](https://developer.android.com/reference/android/app/AlarmManager.html#set(int,%20long,%20android.app.PendingIntent)) this will not display the clock. e.g.

```
  alarm.set(
      AlarmManager.RTC_WAKEUP,
      midnightInMillis,
      PendingIntent.getService(getApplicationContext(), 11, intent, PendingIntent.FLAG_UPDATE_CURRENT)
  );

```