我有一个应该每天都要打电话的闹钟,但它不起作用。如果我每隔一分钟设置一次它,每小时都一样。这是我的报警电话:
try {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MILLISECOND, 1);
Intent intent = new Intent(this, AlarmReceiver.class);
intent.putExtra("alarm_toast", "Working");
PendingIntent sender = PendingIntent.getBroadcast(this, 092809, intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 3600000*3, sender);
} catch (Exception e1) {
e1.printStackTrace();
}
我甚至对发射时间进行了硬编码(目前正在测试3600000 * 3 = 3小时),但它也不适用于每天。我做错了什么?