随着可穿戴及其他一些辅助设备的出现,在这些设备上实现对Android手机的控制就有了需求,如下图。
Android 闹钟应用是在packages/apps/DeskClock下面,查看相关代码发现,闹钟响起的时候会启动一个叫AlarmActivity的类,而这个类注册Receiver来接受广播。
action字符串的定义:
// AlarmActivity listens for this broadcast intent, so that other applications
// can snooze the alarm (after ALARM_ALERT_ACTION and before ALARM_DONE_ACTION).
public static final String ALARM_SNOOZE_ACTION = "com.android.deskclock.ALARM_SNOOZE";
// AlarmActivity listens for this broadcast intent, so that other applications
// can dismiss the alarm (after ALARM_ALERT_ACTION and before ALARM_DONE_ACTION).