我有一个BroadcastReceiver哪个手表android.intent.action.BOOT_COMPLETED,android.intent.action.TIME_SET还有android.intent.action.TIMEZONE_CHANGED。
<receiver android:name="SystemBroadcastReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.TIME_SET" />
            <action android:name="android.intent.action.TIMEZONE_CHANGED" />
            <category android:name="android.intent.category.HOME" />
        </intent-filter>
</receiver>
/** 不正确,见下文每当发生这些操作之一时,接收器将打开一个活动。一切正常,除了当我更改时钟的分钟部分时,android.intent.action.TIME_SET将激活两次,这导致活动打开两次。
我觉得这很奇怪,因为如果我改变时钟的小时部分,android.intent.action.TIME_SET只会激活一次。*/ 我的测试手机是 Galaxy Nexus 4.2.1。这是 4.2.1 中的系统错误还是我做错了什么?
------------由我自己编辑------------ 这是一些可能有帮助的日志。每当我更改分钟、小时或日期时,我的活动都会启动两次。
02-01 21:16:11.781: D/SystemClock(9012): Setting time of day to sec=1359724560
02-01 21:16:00.023: V/AlarmClock(8932): AlarmInitReceiver finished
02-01 21:16:00.031: D/SystemClock(9012): Setting time of day to sec=1359724560
我不知道为什么我只是在系统设置部分更改了一次时间,但系统调用了两次设置时间。