如何使用其他应用程序的Android API(版本2.2或4.4)停止运行警报? "停止应用"例如,使用蓝牙信号启动。
答案 0 :(得分:0)
在手动停止警报的同时观察logcat会产生以下结果:
07-02 02:15:12.363: V/AlarmClock(30848): AlarmStateManager received intent Intent { act=change_state cat=[DISMISS_TAG] dat=content://com.android.deskclock/instances/1 flg=0x10000010 cmp=com.google.android.deskclock/com.android.deskclock.alarms.AlarmStateManager bnds=[637,346][1080,490] (has extras) }
07-02 02:15:12.363: V/AlarmClock(30848): Setting dismissed state to instance 1
07-02 02:15:12.363: V/AlarmClock(30848): Clearing notifications for alarm instance: 1
07-02 02:15:12.373: V/AlarmClock(30848): Canceling instance 1 timers
07-02 02:15:12.383: I/AlarmClock(30848): Disabling parent alarm: 2
07-02 02:15:12.393: V/AlarmClock(30848): AlarmService.onStartCommand() with intent: Intent { act=STOP_ALARM dat=content://com.android.deskclock/instances/1 cmp=com.google.android.deskclock/com.android.deskclock.alarms.AlarmService }
尤其是最后一行似乎很有趣。也许有可能自己创建这个意图来阻止警报..