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. Some background on this: application notifications are supposed to go on the left side of the status bar. However, the UI designers really really really wanted the "alarm set" icon to be on the right. We haven't yet figured out an API to allow third party apps to do this in a sane way, so there is a private facility for the built-in alarm clock to do it. If/when a public API ever appears for this, it will very much not be in its currently implemented form, and any apps relying on these private implementation details will break. On Wed, Jan 19, 2011 at 10:41 AM, Andy Savage <nos...@starsphere.net> wrote: > Good plan, I didn't think of that. In case anyone is searching for > this solution in the future, the in built alarm sets the icon by > broadcasting an intent. I acheived this with the following code: > > protected void setStatusBarIcon(boolean enabled) { > Intent alarmChanged = new > Intent("android.intent.action.ALARM_CHANGED"); > alarmChanged.putExtra("alarmSet", enabled); > sendBroadcast(alarmChanged); > } > > (Done within the scope an Activity, else you will need to pass a > Context). > > > On Jan 19, 6:18 pm, TreKing <treking...@gmail.com> wrote: > > On Wed, Jan 19, 2011 at 12:01 PM, Andy Savage <nos...@starsphere.net> > wrote: > > > Both "Klaxon" and "Alarm Clock Plus" do this (Both have free > > > versions available on market if you want to take a look). > > > > So it does. I would grab the built-in alarm source code and see what it's > > doing. I'd bet that's what they did. > > > > > ------------------------------------------------------------------------------------------------- > > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago > > transit tracking app for Android-powered devices > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en