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);