Android, the alarm icon on the right side of notification area?


When I set an alarm with the build-in alarm clock application, there will be an icon on the right side of notification area. But it won't be there if I set an alarm with AlarmManager. Is there a way I can make that icon show?

<hr />

I found it seems that alarm clock actually writes records to a ContentProvider rather than uses AlarmManager directly. I will give it a try tomorrow.

And it seems the provider is not intent to be used by other applications.



Is there a way I can make that icon show?


That icon is for the Alarm Clock app that is part of the firmware. That icon will only appear if the user has an active Alarm Clock alarm. It cannot be directly manipulated by the Android SDK.


This icon is part of the AlarmClock application NOT the android SDK. Android has a build-in (stock) AlarmClock application but many vendors (like Samsung) are replacing it with their own. So there isn't a safe way to display that particular icon from your application.

The best approach is to make your own icon since you are making an application that sets alarms and you want your users notified.

P.S. Here is the <a href="https://github.com/android/platform_packages_apps_alarmclock/blob/master/src/com/android/alarmclock/AlarmReceiver.java" rel="nofollow">code of the Activity that displays the icon in the stock AlarmClock application</a> as you can see in line 181 the drawable of the icon is <strong>R.drawable.stat_notify_alarm</strong> and not Android.R.drawable.stat_notify_alarm so you cannot use it.

Hope this helps...


(cross-posted from self-answer on related question: <a href="https://stackoverflow.com/questions/23105038/controlling-the-alarm-icon-in-status-bar" rel="nofollow">Controlling the Alarm icon in status bar</a>)

<hr /><h2>v5 Lollipop</h2>

Lollipop finally removed those private API features. This technique no longer works from v5.

I have posted a new question about Lollipop specifically, and hope to have answers there soon:

<ul><li><a href="https://stackoverflow.com/questions/28367822/lollipop-api-for-controlling-the-alarm-icon-in-status-bar" rel="nofollow">Lollipop API for controlling the Alarm icon in status bar</a></li> </ul><h2>Pre-Lollipop</h2>

This is how it is done, using <strong>private api</strong> properties:

protected void setStatusBarIcon(boolean enabled) { Intent alarmChanged = new Intent("android.intent.action.ALARM_CHANGED"); alarmChanged.putExtra("alarmSet", enabled); sendBroadcast(alarmChanged); }

Thanks to Andy Savage on this Google Groups thread:

<ul><li><a href="https://groups.google.com/d/topic/android-developers/pUP15UcZi2M/discussion" rel="nofollow">AlarmManager with alarm icon</a> </li> <li><a href="https://www.mail-archive.com/android-developers@googlegroups.com/msg138053.html" rel="nofollow">direct link to archived post</a></li> </ul><hr />

<strong>Important note:</strong> as stated above, this uses private, undocumented properties. All the usual warnings apply around this, as pointed out by Dianne Hackborn on the same thread:


Note that when you see a raw string like that ("android.intent.action.ALARM_CHANGED" and "alarmSet"), warning bells should be going off in your head that this is using private APIs.

And indeed this is.

If you use this, don't be surprised if it breaks in the future on randomly doesn't work on some devices.



From what I understand from you're question, you're wondering how to make icons appear in the notification area.

You'll have to program that yourself. The documentation outlines this quite well.

<a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html" rel="nofollow">http://developer.android.com/guide/topics/ui/notifiers/notifications.html</a>


  • Celery + Redis - .get() hangs indefinitely after running smoothly for ~70 hours
  • Delphi TCollection - Possible to prevent changing items in run-time?
  • write text on image and show it to a imageview
  • Unable to resolve Static method?
  • EditText is covered by Keyboard
  • Microsoft Excel Pivot miscalculation in Sum for positive and negative numbers
  • ConnectivityManager.CONNECTIVITY_ACTION deprecated
  • CSS - Cannot get one spanned style to override another inherited style and align left
  • Clear activity stack before launching another activity
  • URLConnection doesn't work since API 10 and higher?
  • Clarification on min distance on LocationManager.requestLocationUpdates method, min Distance paramet
  • Suppressing passwd when calling sqlplus from shell script
  • Debugging VB6 Code From Visual Studio 2010
  • Build Successful but not running on simulator
  • Button text different than value submitted in query string
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • iOS: Detect app start via notification press
  • Refering to the class itself from within a class mehod in Objective C
  • Unity3D & Android: Difference between “UnityMain” and “main” threads?
  • Meteor helpers not available in Angular template
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • formatting the colorbar ticklabels with SymLogNorm normalization in matplotlib
  • Is calc() supported in html email?
  • Why is the size of this struct 32?
  • req.body is undefined - nodejs
  • How do I fake an specific browser client when using Java's Net library?
  • How reduce the height of an mschart by breaking up the y-axis
  • Perl system calls when running as another user using sudo
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Symfony2: How to get request parameter
  • To display the title for the current loaction in map in iphone
  • Akka Routing: Reply's send to router ends up as dead letters
  • Is there a mandatory requirement to switch app.yaml?
  • Traverse Array and Display in markup
  • Acquiring multiple attributes from .xml file in c#
  • How to set the response of a form post action to a iframe source?
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • unknown Exception android
  • java string with new operator and a literal