Hi, I studied the alarm manager in android and wondered how to set a specific time for an alarm (or use a notification manager) to leave at a specific time, for example, tomorrow 12pm. The code below sets an alarm for 5 seconds, so to set it to 12 hours, can you do something like 12:00 or something else?
Intent intent = new Intent(this, OnetimeAlarmReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, REQUEST_CODE, intent, 0); AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (5 * 1000), sender); Toast.makeText(this, "Alarm set", Toast.LENGTH_LONG).show();
source share