From 74d861b1e46ce28a109f271873c5d255930201bc Mon Sep 17 00:00:00 2001 From: Jacques Foucry Date: Sun, 6 Nov 2016 22:25:13 +0100 Subject: [PATCH] Try to launch notification in one hour --- .../java/net/foucry/pilldroid/MedicamentListActivity.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java b/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java index 1ba64dc..2d694fa 100644 --- a/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/MedicamentListActivity.java @@ -50,6 +50,7 @@ import java.util.logging.Handler; import static net.foucry.pilldroid.NotificationPublisher.NOTIFICATION_ID; import static net.foucry.pilldroid.UtilDate.date2String; +import static net.foucry.pilldroid.UtilDate.tomorrowAtNoonInMillis; import static net.foucry.pilldroid.Utils.doubleRandomInclusive; /** @@ -314,8 +315,8 @@ public class MedicamentListActivity extends AppCompatActivity { dateSchedule = dateAlerte.getTime(); // If dateAlerte > now we use dateAlerte as scheduleDate } - // int between2DateInMillis = (int) (tomorrow.getTime() - now.getTime()); - scheduleNotification(getNotification(getString(R.string.notification_text)),3600000); + long delay = (long) (dateSchedule - now.getTime()); + scheduleNotification(getNotification(getString(R.string.notification_text)),delay); Log.d(TAG, "Notification scheduled for "+ UtilDate.convertDate(dateSchedule)); }