用于控制在状态栏上的闹钟图标棒棒糖API [英] Lollipop API for controlling the Alarm icon in status bar

查看:235
本文介绍了用于控制在状态栏上的闹钟图标棒棒糖API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个棒棒糖,具体问题,因为API已经更改。要了解如何做到这一点的早期版本,请参阅相关的问题:

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

  • <一个href="http://stackoverflow.com/questions/23105038/controlling-the-alarm-icon-in-status-bar">Controlling在状态栏
  • 闹钟图标
  • 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:

及时闹钟控制在棒棒堂这个图标是1.3版本的。此前版本中,code是使用私有的API中的相关问题的详细介绍。

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.

新的技术,他们使用的作品在一个无根的Nexus 5的运行V5.0.1。

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

看起来还有很多的不仅仅是改变图标这个新的API。锁屏现在也显示我已经设置了报警的时间。

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.

推荐答案

AlarmManager有一个新的API来设置此。

AlarmManager has a new api to set this.

<一个href="http://developer.android.com/reference/android/app/AlarmManager.html#setAlarmClock(android.app.AlarmManager.AlarmClockInfo,%20android.app.PendingIntent)">AlarmManager.setAlarmClock (AlarmManager.AlarmClockInfo信息,   PendingIntent操作)

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

如果你做到这一点,在通知栏和的LockScreen报警显示。

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

这篇关于用于控制在状态栏上的闹钟图标棒棒糖API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆