Lollipop API for controlling the Alarm icon in status bar

人走茶凉 提交于 2019-11-27 02:49:03

问题


This is a Lollipop-specific question, since the API has changed. To find out how to do this on earlier versions, see related question:

  • Controlling the Alarm icon in status bar

I would like to know how to turn on / off the system Alarm icon in the status bar as shown in this image:

Timely Alarm Clock controls this icon on Lollipop as of release 1.3. Prior to that release, the code was using private APIs as detailed in the related question.

The new technique they use works on an unrooted Nexus 5 running v5.0.1.


Update

It looks like there is a lot more the this new API than just changing the icon. The lock screen now also displays the time I have set the alarm for.


回答1:


AlarmManager has a new api to set this.

AlarmManager.setAlarmClock (AlarmManager.AlarmClockInfo info, PendingIntent operation)

If you do this, the alarm shows on notification bar and LockScreen .



来源:https://stackoverflow.com/questions/28367822/lollipop-api-for-controlling-the-alarm-icon-in-status-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!