我正在尝试为我的数据库值设置警报。在数据库中,我将 4 个值 alarm1、alarm2、alarm3、alarm4 保存在一行中。我需要为这 4 个值设置警报。如何为我的应用程序设置闹钟。请任何人帮助我。下面是设置闹钟的代码。
Intent myIntent = new Intent(this, MyAlarmService.class);
pendingIntent = PendingIntent.getService(this, (int) System.currentTimeMillis(), myIntent, 0);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, hour1);
calendar.set(Calendar.MINUTE, min1);
calendar.set(Calendar.SECOND, 0);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 24*60*60*1000, pendingIntent);
Toast.makeText(this, "Start Daily Alarm", Toast.LENGTH_LONG).show();