2012-04-21 56 views
0

下面是我的代碼裏面和onClickListner,我想顯示通知,一段時間後面說30秒,但它立即顯示。android deplayed通知,立即工作

 String title = "sample title" 
     String text = "sample text"; 

     Calendar target = Calendar.getInstance(); 
     target.set(Calendar.HOUR_OF_DAY, model.getAlarmHour()); 
     target.set(Calendar.MINUTE, model.getAlarmMinute()); 
     target.set(Calendar.SECOND, 0); 

     int icon = android.R.drawable.stat_notify_error; 

     String ns = context.NOTIFICATION_SERVICE; 
     NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns); 

     Intent notificationIntent = new Intent(context, WakeUpNotify.class); 
     PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); 

     Notification notification = new Notification(icon, text, target.getTimeInMillis()); 
     notification.setLatestEventInfo(appContext, title, text, contentIntent); 

     mNotificationManager.notify(notifyId, notification); 

回答

0

你當顯示的Notificationtarget不控制。它僅確定通知抽屜條目中顯示此項目的時間。