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

Я хочу настроить свое уведомление в Android на определенную дату и время, я пытаюсь использовать дату в java, но мое уведомление запускается раньше времени . так что я могу сделать, чтобы его уволили в указанное время. Заранее спасибо!

Вот мой код для уведомления:

Calendar cal = java.util.Calendar.getInstance();
cal.set(2012, 00, 30);
Date date = cal.getTime();
date.setHours(17);
date.setMinutes(30);
date.setSeconds(15);

long time = date.getTime();

Log.e("date is",""+date);
long when = time;


Notification notification = new Notification(notificationIcon,tickerText,date.getTime());

notification.when = date.getTime();

RemoteViews contentView = new RemoteViews("com.LayoutDemo",R.layout.userscreen);        
notification.contentView= contentView;
Intent intent = this.getIntent();
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, 0);
notification.contentIntent= contentIntent;

notification.flags= Notification.FLAG_AUTO_CANCEL;

int NOTIFICATION_ID =1;             
nManager.notify(NOTIFICATION_ID,notification);
5
задан SpeedBirdNine 30 January 2012 в 12:26
поделиться