I know how to trigger an X millisecond notification after some click event. Code like this
Timer timer = new Timer(); TimerTask timerTask = new TimerTask() { @Override public void run() { triggerNotification(); } }; timer.schedule(timerTask, 3000);
If the notification code is as follows
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);
How can I set a notification to be displayed on a specific date at a specific time, say, October 1, 7 pm
android notifications
sandalone Sep 24 2018-11-17T00: 00Z
source share