2012-04-21 38 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不控制。它仅确定通知抽屉条目中显示此项目的时间。