in notification manager we use this method to set the time and date for notification notification
.setWhen(System.currentTimeMillis());
but System.currentTimeMillis()will return the current time on the device, but I want to add the specified time (Friday 15:00)
How can i do this? how can i set this time in milliseconds and load it into.setWhen
early
I use this code
Notification.Builder builder =
new Notification.Builder(MyActivity.this);
builder.setSmallIcon(R.drawable.ic_launcher)
.setTicker("Notification")
.setWhen(System.currentTimeMillis())
.setDefaults(Notification.DEFAULT_SOUND |
Notification.DEFAULT_VIBRATE)
.setSound(
RingtoneManager.getDefaultUri(
RingtoneManager.TYPE_NOTIFICATION))
.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 })
.setLights(Color.RED, 0, 1);
Notification notification = builder.getNotification();
source
share