Calendar c = Calendar.getInstance();// 获取日期对象
c.setTimeInMillis(System.currentTimeMillis()); // 设置Calendar对象
c.set(Calendar.HOUR_OF_DAY, 12); // 设置闹钟小时数
c.set(Calendar.MINUTE,10); // 设置闹钟的分钟数
c.set(Calendar.SECOND, 0); // 设置闹钟的秒数
c.set(Calendar.MILLISECOND, 0); // 设置闹钟的毫秒数
Intent intent = new Intent(ReceiverConstant.AlarmTask_Receiver); // 创建Intent对象
PendingIntent pi = PendingIntent.getBroadcast(CodeService.this, 0,
intent, 0); // 创建PendingIntent
alarmManager.set(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pi); // 设置闹钟
c.setTimeInMillis(System.currentTimeMillis()); // 设置Calendar对象
c.set(Calendar.HOUR_OF_DAY, 12); // 设置闹钟小时数
c.set(Calendar.MINUTE,10); // 设置闹钟的分钟数
c.set(Calendar.SECOND, 0); // 设置闹钟的秒数
c.set(Calendar.MILLISECOND, 0); // 设置闹钟的毫秒数
Intent intent = new Intent(ReceiverConstant.AlarmTask_Receiver); // 创建Intent对象
PendingIntent pi = PendingIntent.getBroadcast(CodeService.this, 0,
intent, 0); // 创建PendingIntent
alarmManager.set(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pi); // 设置闹钟