0

Is there anyway to trigger some code when the Alarm in the clock-application is executed? I read about the Alarm Manager but its only for creating your own alarms.

I guess you will never be sure if the clock-application exists on the device. But if it does I would like to get notified.

/Br Johannes

4

1 回答 1

6

警告:您正在尝试获取有关时钟状态的通知。此应用程序不是官方 Android SDK 的一部分:Google 不支持(或推荐)以下解决方案,如有更改,恕不另行通知。

查看源代码 od DeskClock(AlarmClock 的新名称)。具体看一下它的AndroidManifest.xml

它似乎收到com.android.deskclock.ALARM_ALERT

<receiver android:name="AlarmReceiver">
    <intent-filter>
        <action android:name="com.android.deskclock.ALARM_ALERT" />
        <action android:name="alarm_killed" />
        <action android:name="cancel_snooze" />
    </intent-filter>
</receiver>

尝试在您的应用中注册此接收器。

于 2010-12-29T13:55:54.860 回答