Как начать уведомление о настраиваемой дате и времени?

Я знаю, как запустить уведомление через X миллисекунд после некоторого события щелчка. Такой код

        Timer timer = new Timer();
        TimerTask timerTask = new TimerTask() {
            @Override
            public void run() {
                triggerNotification();
            }
        };
        timer.schedule(timerTask, 3000);

Где код для уведомления выглядит так

CharSequence title = "Hello";
CharSequence message = "Hello, Android!";

NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon, "A New Message!", System.currentTimeMillis());

Intent notificationIntent = new Intent(this, AndroidAlarmService.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

notification.setLatestEventInfo(AndroidAlarmService.this, title, message, pendingIntent);
notification.defaults = Notification.DEFAULT_SOUND;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(NOTIFICATION_ID, notification);

Как я могу настроить отображение уведомления в определенную дату в определенное время, скажем, 1 октября, 19:00?

5
задан sandalone 24 September 2011 в 17:43
поделиться