Lollipop API 用于控制状态栏中的警报图标 [英] Lollipop API for controlling the Alarm icon in status bar

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

问题描述

这是 Lollipop 特定的问题,因为 API 已更改.要了解如何在早期版本中执行此操作,请参阅相关问题:

  • 从 1.3 版开始,在 Lollipop 上控制此图标.在该版本之前,代码使用了相关问题中详述的私有 API.

    他们使用的新技术适用于运行 v5.0.1 的无根 Nexus 5.

    <小时>

    更新

    看起来这个新 API 不仅仅是改变图标.锁定屏幕现在还显示我设置闹钟的时间.

    解决方案

    AlarmManager 有一个新的 api 来设置这个.

    <块引用>

    AlarmManager.setAlarmClock(AlarmManager.AlarmClockInfo 信息,PendingIntent 操作)

    如果你这样做,警报会显示在通知栏和锁屏上.

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


    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.

    解决方案

    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 .

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

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