title: Android Studio set an exact alarm with Icon
body: <p>I'am trying to make an Alarmclock App. Currently I'am using AlarmManager. My minSdkVersion is API Level 19.</p>
  
  <p>The Problem is, i cant get an exact Alarm like other apps. For Example AlamDroid in the Playstore: It fires the Alarm right in the second when the clock switches to the set Time. It works also on API 19.</p>
  
  <p>My Code right now is:</p>
  
  <pre><code> Calendar calendar = Calendar.getInstance();
   calendar.setTimeInMillis(System.currentTimeMillis());
   calendar.set(Calendar.HOUR_OF_DAY, hour);
   calendar.set(Calendar.MINUTE, minute);
  
   if (calendar.getTimeInMillis() &lt; System.currentTimeMillis())
       calendar.add(Calendar.HOUR, 24);
  
   Intent myIntent = new Intent(context, AlarmReceiver.class);
   myIntent.putExtra(DB_ID, myID);
   pendingIntent = PendingIntent.getBroadcast(context, myID, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
   alarmManager.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
  </code></pre>
  
  <p>The Problem is that in AlarmDroid I get on API Levl 19 an AlarmIcon in the upper Android Statusbar. But how did he do that? Because <code>alarmManager.setAlarmClock</code> is only available at API>= 21. And the Icon comes only with this one!</p>
  
  <p>But still, the accuracy in AlarmDroid is perfect on the second! While mine is worse. Is there any other Method than AlarmManager? Or: What I'am doing wrong? Why I Can't set an very accurate Alarm like the other AlarmClock Apps in the PlayStore. Even with Notification in the Statusbar...</p>
  
  <p>EDIT: On AlarmDroid and other Alarm Apps there is a Notification in the Statusbar one Minute before the Alarm fires off. This seems to be like something built in as every AlarmApp has it!</p>
  
  <p>EDIT2: How is it possible that other Alarms in the Appstore are able to be exact?</p>
  
  <p><strong>EDIT -> POSSIBLE SOLUTION:</strong></p>
  
  <p>For all with the same Problem please look over here:</p>
  
  <p><a href="https://stackoverflow.com/questions/34074955/android-exact-alarm-is-always-3-minutes-off">Link to Stackoverflow Question - Answer from Paweł Nadolski /  Mathieu H.</a></p>
  
  <p>This might be an Explanation / Solution for Samsungphones. It seems that they are checking the Pakagename for Keywords like "alarm", "alert" in order to make the Alarm more exact!</p>